Fix Trac #2334: validity checking for type families
authorsimonpj@microsoft.com <unknown>
Fri, 6 Jun 2008 12:17:30 +0000 (12:17 +0000)
committersimonpj@microsoft.com <unknown>
Fri, 6 Jun 2008 12:17:30 +0000 (12:17 +0000)
When we deal with a family-instance declaration (TcTyClsDecls.tcFamInstDecl)
we must check the TyCon for validity; for example, that a newtype has exactly
one field.  That is done all-at-once for normal declarations, and had been
forgotten altogether for families.

I also refactored the interface to tcFamInstDecl1 slightly.

A slightly separate matter: if there's an error in family instances
(e.g. overlap) we get a confusing error message cascade if we attempt to
deal with 'deriving' clauses too; this patch bales out earlier in that case.

Another slightly separate matter: standalone deriving for family
instances can legitimately have more specific types, just like normal
data decls. For example

   data instance F [a] = ...
   deriving instance (Eq a, Eq b) => Eq (F [(a,b)])

So tcLookupFamInstExact can a bit more forgiving than it was.


No differences found