Version 2 (modified by goldfire, 2 years ago) (diff)


Template Haskell changes to support overlapping type family instances

The current form of a type family instance in Template Haskell is this constructor of the Dec type:

TySynInstD Name [Type] Type

Here is the implemented new constructor:

TySynInstD Name TySynEqn


data TySynEqn = TySynEqn [Type] Type

represents one equation with a list of left-hand side patterns and a single right-hand side result.

We also add a new declaration form to the Dec type

ClosedTypeFamilyD Name [TyVarBndr] (Maybe Kind) [TySynEqn]

with a straightforward meaning.