Rank-N types
From HaskellWiki
(Difference between revisions)
(a real description of rank n types) |
m (not a stub) |
||
| Line 1: | Line 1: | ||
[[Category:Language extensions]] | [[Category:Language extensions]] | ||
| - | |||
== About == | == About == | ||
Revision as of 12:49, 26 August 2007
1 About
Normal Haskell '98 types are considered Rank-1 types. A Haskell '98 type signature such as
a -> b -> a
implies that the type variables are universally quantified like so:
forall a b. a -> b -> a
forall
(->)
forall a. a -> (forall b. b -> a)
is also a Rank-1 type because it is equivalent to the previous signature.
However, aforall
(->)
forall
(forall a. a -> a) -> (forall b. b -> b)
forall
Rank-N type reconstruction is undecidable in general, and some explicit type annotations are required in their presence.
Rank-2 or Rank-N types may be specifically enabled by the language extensions
{-# LANGUAGE Rank2Types #-}
{-# LANGUAGE RankNTypes #-}
2 Also see
Rank-N types on the Haskell' website.
