Restrictions on polytypes with type families

Richard Eisenberg eir at cis.upenn.edu
Wed Apr 3 18:39:30 CEST 2013


Hi all,

GHC doesn't allow type families to be used with polytypes: 
1) The right-hand side of a type family instance cannot have a "forall".
2) A type family cannot be applied to a type containing a "forall".
3) A pattern in a type family instance is (oddly) allowed to contain "forall", but this is silly because of (2).

Do these restrictions have known reasons for their existence? Or, are there any that are restricted because someone needs to think hard before lifting it, and no one has yet done that thinking? I know, for example, that the unify function in types/Unify.lhs will have to be completed to work with foralls, but this doesn't seem hard.

I've run into two separate cases where I've hit this restriction, so this isn't just idle thought.

Thanks,
Richard


More information about the ghc-devs mailing list