Fix Trac #3087: derived Data now defines dataCast1/2
authorsimonpj@microsoft.com <unknown>
Fri, 13 Mar 2009 13:44:36 +0000 (13:44 +0000)
committersimonpj@microsoft.com <unknown>
Fri, 13 Mar 2009 13:44:36 +0000 (13:44 +0000)
commit8fda9784f1eff82aa243073fd31b181080be3109
treeab3b6771ca571edc01619ef0ae152299acc379ef
parent168b79b497c49f1a557aaeb173afd4d18528aeac
Fix Trac #3087: derived Data now defines dataCast1/2

This patch generates code in deriving(Data) for dataCast1 or 2 as
appropriate.

While I was there I did some refactoring (of course), pulling out
the TcDeriv.inferConstraints as a separate function.

I don't think it's worth merging this to 6.10.2, even though it's a bugfix,
because it modifies code that I added in the HEAD only (for deriving Functor)
so the merge will be sligtly awkward.  And there's an easy workaround.
compiler/typecheck/TcDeriv.lhs
compiler/typecheck/TcGenDeriv.lhs