You need a language extension.
Check out Section 7 of "Derivable type classes"
http://research.microsoft.com/~simonpj/Papers/derive.htm
Alas, I have not implemented the idea yet.
(Partly because no one ever reports it as a problem; you
are the first!)
Simon
| One day I was playing around with types and I came across this type:
|
| >data S m a = Nil | Cons a (m (S m a))
|
| The idea being one could use generic functions with whatever
| monad m (of course m doesn't need to be a monad but my
| original idea was to be able to make mutable lists with some
| sort of monad m.)
|
| Anyway in attempting to define a generic show instance for
| the above datatype I finally came upon:
|
| >instance (Show a, Show (m (S m a))) => Show (S m a) where
| > show Nil = "Nil"
| > show (Cons x y) = "Cons " ++ show x ++ " " ++ show y
|
| which boggles my mind. But hugs +98 and ghci
| -fallow-undecidable-instances both allow it to compile but when i try
_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe