Fix Trac #3965: tighten conditions when deriving Data
authorsimonpj@microsoft.com <unknown>
Fri, 9 Apr 2010 18:44:20 +0000 (18:44 +0000)
committersimonpj@microsoft.com <unknown>
Fri, 9 Apr 2010 18:44:20 +0000 (18:44 +0000)
commitcfc8f7c2a49494d47d2966b310c5b3fbc2ae2499
treea82c74e61e39f18143277e60e26e843b4327bff4
parent0c72a3ada46ae38fef4d800423ba046f99c119c6
Fix Trac #3965: tighten conditions when deriving Data

It's tricky to set up the context for a Data instance.  I got it wrong
once, and fixed it -- hence the "extra_constraints" in
TcDeriv.inferConstraints.

But it still wasn't right!  The tricky bit is that dataCast1 is only
generated when T :: *->*, and dataCast2 when T :: *->*->*. (See
the code in TcGenDeriv for dataCastX.
compiler/typecheck/TcDeriv.lhs