
5 Dec
2009
5 Dec
'09
4:31 a.m.
Hello. Consider the type: (forall a . a) -> String. On one hand, it is rank-2 polymorphic, because it abstracts over a rank-1 polymorphic type. On the other hand, it is monomorphic because it isn't actually quantified itself: in my intuitive view, a parametrically polymorphic type has infinitely many instantiations (for example, Int -> Int is an instantiation of forall a . a -> a, and String -> String also is), and this type doesn't have any instantiations at all. Which is correct? Is there really a contradiction? What is the definition of rank of a polymorphic type? -- Eugene Kirpichov Web IR developer, market.yandex.ru