Changes between Version 2 and Version 3 of RankNTypes


Ignore:
Timestamp:
Dec 17, 2005 12:15:56 PM (8 years ago)
Author:
ross@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RankNTypes

    v2 v3  
    66== Brief Explanation == 
    77 
     8Haskell 98 provides only rank-1 types: universal quantification is over the whole type expressions, and is implicit, e.g. 
     9{{{ 
     10const :: a -> b -> a 
     11}}} 
     12Rank-2 types may have polymorphic arguments, marked by `forall`, e.g. 
     13{{{ 
     14plus :: (forall a. a -> a) -> (forall a. a -> a) -> b -> b 
     15}}} 
     16Rank-3 types may have arguments of rank-2 type, e.g. 
     17{{{ 
     18f3 :: ((forall a. a->a) -> Int) -> Bool -> Bool 
     19}}} 
     20and so on to arbitrary depth. 
     21 
     22`forall`s in the second argument of `->` could be permitted as a convenience, but they are equivalent to `forall`s further out. 
     23`forall`s are not permitted inside arguments of other type constructors. 
     24 
     25The GHC User's Guide has some vague remarks about how type signature information is used. 
     26Perhaps someone could elaborate. 
     27 
    828== References == 
    9  * [http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#universal-quantification] GHC documentation. 
    10  * [http://research.microsoft.com/Users/simonpj/papers/higher-rank/index.htm] Practical type inference for arbitrary-rank types  
     29 * [http://www.haskell.org/ghc/docs/latest/html/users_guide/type-extensions.html#universal-quantification Arbitrary-rank polymorphism] in the GHC User's Guide. 
     30 * [http://research.microsoft.com/Users/simonpj/papers/higher-rank/index.htm Practical type inference for arbitrary-rank types], Simon Peyton Jones, Dimitrios Vytiniotis, Stephanie Weirich and Mark Shields, July 2005. 
     31 * [wiki:Rank2Types] are a special case 
    1132 
    1233== Pros == 
     34 * More convenient than encodings using PolymorphicComponents 
    1335 
    1436== Cons == 
     37 * More complex than [wiki:Rank2Types], which cover the most common cases (and can encode the rest, though clumsily). 
     38 * No clear programmer-level description of the restrictions that apply.