rank-2 vs. arbitrary rank types
Simon Peyton-Jones
simonpj at microsoft.com
Tue Feb 20 08:33:51 EST 2007
| > >* The ability to put foralls *after* a function arrow is definitely
| > >useful, especially
| > >when type synonyms are involved. Thus
| > > type T = forall a. a->a
| > > f :: T -> T
| > >We should consider this ability part of the rank-N proposal. The
| > >"Practical type
| > >inference" paper deal smoothly with such types. GHC's rank-2 design had an
| > >arbitrary and unsatisfactory "forall-hoisting" mechanism which I hated.
|
| Without impredicativity, putting forall's in type synonyms raises extra
| issues, e.g. a programmer must fully expand the definition of a type T
| to know whether Maybe T is a legal type.
But similar things are already true. Is this legal:
f :: T
f x = x
Well, you have to expand T to find out.
Simon
More information about the Haskell-prime
mailing list