Yes, this is a change. To guarantee that we generate terminating instance declarations, GHC now insists that it can reduce the context of a derived instance to instance (C a, D b) => ... That is, the context of the instance decl must consist of (class applied to type variables). Without this constraint it's all too easy to generate non-terminating instances.
So the deriving mechanism works in straightforward cases, and for more complicated cases you have to write the instances yourself. It's not impossible that the deriving mechanism could be made a little more liberal, but it errs on the conservative side at the moment. There's no workaround - -you just have to write the instance yourself. I should document this Simon From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Conal Elliott Sent: 15 August 2007 23:37 To: [email protected] Subject: change to deriving in 6.7 ?? I'm running ghc-6.7.20070802 and getting a new error message that didn't show up with ghc-6.6. Code: -- | Pairing for unary type constructors. newtype Pair1 f g a = Pair1 {unPair1 :: (f a, g a)} deriving (Eq, Ord, Show) Error message: src/Data/Tupler.hs:26:0: No instances for (Show (g a), Show (f a)) arising from the 'deriving' clause of a data type declaration at src/Data/Tupler.hs:(26,0)-(27,25) Possible fix: add an instance declaration for (Show (g a), Show (f a)) When deriving the instance for (Show (Pair1 f g a)) Has there been a change to "deriving"? Is there a workaround? Thanks, - Conal
_______________________________________________ Cvs-ghc mailing list [email protected] http://www.haskell.org/mailman/listinfo/cvs-ghc
