ConstraintKinds feature suggestion and question about type family peculiarity

Roman Cheplyaka roma at
Sun Jun 16 08:59:25 CEST 2013

* Merijn Verstraaten <merijn at> [2013-06-15 22:05:52+0100]
> 2) for some reason the type families syntax always requires a full
>    argument list, which I find rather ugly. I would much prefer to use
>    KindSignatures and write "type family Restrict :: * -> [*] ->
>    Constraint", but GHC does not allow this. Is there a specific
>    reason for not allowing this syntax?

I believe this is done to simplify (or even enable) type inference.

This is similar to the situation with type synonyms.

  type M1 = Maybe

is different from

  type M2 a = Maybe a

in that M1 has kind * -> *, while M2 is not a type constructor and
doesn't have a kind — but when applied to a type of kind * it expands
to a type of kind *.

The same with the type families. You can define type families that
return e.g. [*] -> *, but then you cannot pattern match on the [*]
type argument. If you could, that would be equivalent to type-level
lambdas, and that would make type inference hard or impossible.


More information about the Glasgow-haskell-users mailing list