#6102: Subclass Specialization in Rewrite Rules
------------------------------+---------------------------------------------
Reporter: SamAnklesaria | Owner:
Type: feature request | Status: new
Priority: normal | Component: Compiler
Version: 7.4.1 | Keywords:
Os: Unknown/Multiple | Architecture: Unknown/Multiple
Failure: None/Unknown | Testcase:
Blockedby: | Blocking:
Related: |
------------------------------+---------------------------------------------
Rewrite rules can define a specialized version of a method for some
specific datatype, but they cannot currently define a specialized version
of a method for some specific superclass.
{{{
class ClassOne a where
classOneOp :: a -> a
class ClassOne a => ClassTwo a where
classTwoOp :: a -> a
data ClassInstance = ...
instance ClassOne ClassInstance where
classOneOp = ...
specialFunc :: ClassInstance -> ClassInstance
specialFunc = ...
{-# RULES
"willcompile" forall i. classOneOp i = specialFunc
"wontcompile" forall i. classOneOp i = classTwoOp i
#-}
}}}
Although we can specialize ''classOneOp'' for ''ClassInstance'', we can't
do so for those instances of ''ClassOne'' that are also instances of
''ClassTwo''.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/6102>
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