Fix Trac #2856: make deriving work for type families
authorsimonpj@microsoft.com <unknown>
Wed, 31 Dec 2008 14:41:51 +0000 (14:41 +0000)
committersimonpj@microsoft.com <unknown>
Wed, 31 Dec 2008 14:41:51 +0000 (14:41 +0000)
commit79a6f3fa318020567566f92740ba6b9eb542f73f
tree774c69d2c9a87283381bcc6bd5ec87b2c0958c57
parent2b398b2215fd5238e222bcb3013aa41d7b631cfa
Fix Trac #2856: make deriving work for type families

Darn, but TcDeriv is complicated, when type families get in on
the act!  This patch makes GeneralisedNewtypeDeriving work
properly for type families.  I think.

In order to do so, I found that GeneralisedNewtypeDeriving can
work for recursive newtypes too -- and since families are conservatively
marked recursive, that's a crucial part of the fix, and useful too.
See Note [Recursive newtypes] in TcDeriv.
compiler/typecheck/TcDeriv.lhs
compiler/typecheck/TcEnv.lhs
compiler/typecheck/TcInstDcls.lhs