Haskell Language

Arbitrary-rank polymorphism with RankNTypes

Introduction#

GHC’s type system supports arbitrary-rank explicit universal quantification in types through the use of the Rank2Types and RankNTypes language extensions.

Syntax#

  • Arbitrary rank quantification is enabled with either the Rank2Types or RankNTypes language extension.
  • With this extension enabled, the forall keyword can be used to add higher-rank quantification.

RankNTypes

StackOverflow forces me to have one example. If this topic is approved, we should move this example here.


This modified text is an extract of the original Stack Overflow Documentation created by the contributors and released under CC BY-SA 3.0 This website is not affiliated with Stack Overflow