First-Class Polymorphism for ML

Stefan Kahrs

Abstract: Polymorphism in ML is implicit: type variables are silently introduced and eliminated. This is fine in the core language of Standard ML, but the lack of an explicit declaration of type variables restricts the expressiveness of parameterised modules (functors). Certain polymorphic functions cannot be expressed as functors, because implicit type parameters of polymorphic functions are in one respect more powerful than formal type parameters of functors. The title suggests that this lack of expressiveness is due to a restricted ability to abstract -- polymorphism is restricted. Type variables in Standard ML can only be abstracted from value declarations, but not from other forms of declarations, especially not from structure declarations. Analogous restrictions exist in other languages too, for instance Miranda. The paper shows in the case of Standard ML how (syntax and) semantics can be modified to fill this language gap. This is not so much a question of programming language design as a contribution for better understanding the relationship between polymorphic functions, polymorphic types, and functors.

An abridged version of this paper will appear in the proceedings of the European Symposium on Programming 94. The proceedings will be published by Springer-Verlag.

LFCS report ECS-LFCS-94-284, February 1994.

Previous | Index | Next