O'Reilly logo

Haskell Design Patterns by Ryan Lemmer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required