Arbitrary-rank polymorphism with RankNTypes
GHC’s type system supports arbitrary-rank explicit universal quantification in types through the use of the Rank2Types and RankNTypes language extensions.
RankNTypes
Section titled “RankNTypes”StackOverflow forces me to have one example. If this topic is approved, we should move this example here.
Syntax
Section titled “Syntax”- Arbitrary rank quantification is enabled with either the
Rank2TypesorRankNTypeslanguage extension. - With this extension enabled, the
forallkeyword can be used to add higher-rank quantification.