[Haskell-cafe] What is the rank of a polymorphic type?

Eugene Kirpichov ekirpichov at gmail.com
Sat Dec 5 16:00:51 EST 2009


2009/12/5 Stefan Holdermans <stefan at cs.uu.nl>:
> Eugene,
>
>> Consider the type: (forall a . a) -> String.
>
> It's of rank 2.
>
>> What is the definition of rank of a polymorphic type?
>
> The minimal rank of a type is given by
>
>  rank (forall a. t) = 1 `max` rank t
>  rank (t -> u)      = (if rank t == 0 then 0 else rank t + 1) `max` rank u
>  rank _             = 0
>

Thanks!
1) Does there exist an authoritative source saying the same? Not that
I'm doubting, just supposing that the source would have other
interesting information, too :)
2) Is it true that rank (forall a . a, forall a . a) == 0 ?

> HTH,
>
>  Stefan
>



-- 
Eugene Kirpichov
Web IR developer, market.yandex.ru


More information about the Haskell-Cafe mailing list