Generics and type classes
MR K P SCHUPKE
k.schupke at imperial.ac.uk
Mon Feb 2 11:47:56 EST 2004
Because the 'cast' operator used in generics, works on having a concrete
type to cast to. What you need to do is:
module TypeTest where
import Data.Generics
class Data a => MyClass a
instance MyClass ExampleType1
instance MyClass ExampleType2
special :: ExampleType1 -> ExampleType1
special = ...
special2 :: ExampleType2 -> ExampleType2
special2 = ...
generic :: MyClass a => a -> a
generic = everywhere (mkT special `extT` special2 ...)
Regards,
Keean.
More information about the Glasgow-haskell-users
mailing list