patch applied (ghc): Fix Trac #2334: validity checking for type
families
Simon Peyton Jones
simonpj at microsoft.com
Fri Jun 6 09:09:31 EDT 2008
Fri Jun 6 05:17:30 PDT 2008 simonpj at microsoft.com
* Fix Trac #2334: validity checking for type families
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.
M ./compiler/typecheck/TcDeriv.lhs -22 +30
M ./compiler/typecheck/TcInstDcls.lhs +3
M ./compiler/typecheck/TcTyClsDecls.lhs -11 +9
View patch online:
http://darcs.haskell.org/ghc/_darcs/patches/20080606121730-1287e-fdedb9cd7550de00aba8d5b04f755523accafe68.gz
More information about the Cvs-ghc
mailing list