First-class Polymorphism

I've been reading and trying to understand First-class Polymorphism with Type Inference (FCPWI); the "monads as first-class values" example in FCPWI was quite interesting. I was wondering if there were any languages that currently implement first-class polymorphism (FCP), and whether they support type inference.

From my searches, it would seem that MLF supports FCP, though MLF is still in its infancy; higher-rank types seem to have the same expressiveness as FCP, but I'm not certain as I'm still a type newbie. If that equivalency is valid, then the Morrow interpreter qualifies. Anything else?

The system described in FCPWI seems interesting, but I haven't seen it implemented anywhere, so I was just wondering what its limitations are.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Does this mean there aren't any?

Does the lack of responses mean there aren't any languages incorporating first-class polymorphism with type inference? I haven't really been able to find anything via google except what I cited, or I wouldn't have asked. Or is FCP perhaps not as interesting as I believe it to be?

OCaml, Haskell/GHC, Moscow ML

...all support first-class polymorphism in different forms (OCaml: records or objects with polymorphic fields; GHC: datatypes with polymorphic arguments, higher-ranked types; Moscow ML: first-class modules). Neither can infer it, though.

all support first-class

all support first-class polymorphism in different forms

I was aware of this, but I was under the impression that the first-class polymorphism as presented in the paper was more general than any of the languages mentioned in your post supported. Am I mistaken? Is type inference the only advantage of the system presented in the paper?


AFAICS, it's only type inference and corresponding syntactic convenience (you don't need to inject/project polymorphic values). GHC also offers this with its higher-ranked types, and I believe the inference algorithm used there actually is much more powerful than what's in the above paper.

IIRC, the paper also adds first-class existential polymorphism. This is available in Haskell and with Moscow ML's first-class modules, but not in OCaml (you would have to encode it).

Check out Scala. If I

Check out Scala.

If I understand what FCP/TI is, then Scala has it.