#6102: Subclass Specialization in Rewrite Rules
-------------------------------+--------------------------------------------
Reporter: SamAnklesaria | Owner: SamAnklesaria
Type: feature request | Status: closed
Priority: normal | Milestone:
Component: Compiler | Version: 7.4.1
Resolution: invalid | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Difficulty: Unknown
Testcase: | Blockedby:
Blocking: | Related:
-------------------------------+--------------------------------------------
Changes (by simonpj):
* status: new => closed
* resolution: => invalid
Comment:
Oh silly me. Of course `ClassInstance` is not an instance of `ClassTwo`.
If you add such an instance all is well. Code below compiles fine
{{{
module T6102 where
class ClassOne a where
classOneOp :: a -> a
class ClassOne a => ClassTwo a where
classTwoOp :: a -> a
data ClassInstance = A | B
instance ClassOne ClassInstance where
classOneOp _ = A
instance ClassTwo ClassInstance where
classTwoOp _ = B
specialFunc :: ClassInstance -> ClassInstance
specialFunc _ = A
{-# RULES
"willcompile" forall i. classOneOp i = specialFunc
"alsocompiles" forall i. classOneOp i = classTwoOp i :: ClassInstance
#-}
}}}
So I'll close this.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6102#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs