Type-level programming

Type families bring functions to the type-level. Polymorphic kinds bring polymorphism to the kind-level. Type promotion bring datatypes and type-safety to the kind-level.

Two major problems of the Haskell kind system are solved by these extensions:

  • The kind system is too restrictive (because it lacks polymorphism)
    • Solution: Provide polymorphism on the kind level (PolyKinds)
  • The kind system is too permissive (kinds are too vague)
    • Solution: Promote datatypes to kinds to simulate a type-system on the kind-level (DataKinds)

Haskell98 already carried the seed for type-level programming by including multiparameter type-classes. Since then, the Haskell kind-system has been enriched with functional dependencies, GADTs, type families, ...

Get Haskell Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.