First-class polymorphism for ML

  • Stefan Kahrs
Contributed Papers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 788)


Polymorphism in ML is implicit: type variables are silently introduced and eliminated. 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 can only be abstracted from value declarations, but not from other forms of declarations, especially not from structure declarations.

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.


  1. 1.
    Hendrik P. Barendregt. Lambda calculi with types. In Handbook of Logic in Computer Science, Vol.2, pages 117–309. Oxford Science Publications, 1992.Google Scholar
  2. 2.
    Roberto di Cosmo. Type isomorphisms in a type-assignment framework. In 19th ACM Symposium on Principles of Programming Languages, pages 200–210, 1992.Google Scholar
  3. 3.
    Bernd Gersdorf. Entwurf, formale Definition und Implementierung der funktionallogischen Programmiersprache ET. PhD thesis, Universität Bremen, 1992. (mainly in German).Google Scholar
  4. 4.
    Robert Harper, John C. Mitchell, and Eugenio Moggi. Higher-order modules and the phase distinction. In 17th ACM Symposium on Principles of Programming Languages, pages 341–354, 1990.Google Scholar
  5. 5.
    Fritz Henglein. Type inference with polymorphic recursion. ACM Transactions on Programming Languages and Systems, 15(2):253–289, 1993.Google Scholar
  6. 6.
    Roger Hindley. The principal type-scheme of an object in combinatory logic. Transactions of AMS, 146:29–60, 1969.Google Scholar
  7. 7.
    Ralf Hinze. Einführung in die funktionale Programmierung mit Miranda. Teubner, 1992. (in German).Google Scholar
  8. 8.
    Ian Holyer. Functional Programming with Miranda. Pitman, 1991.Google Scholar
  9. 9.
    P. Hudak, S. Peyton Jones, and P. Wadler. Report on the Programming Language Haskell, a Non-strict, Purely Functional Language. Technical report, University of Glasgow, 1992. (also in SIGPLAN Notices 27(5), May 1992).Google Scholar
  10. 10.
    Stefan Kahrs. Mistakes and ambiguities in the definition of Standard ML. Technical Report ECS-LFCS-93-257, University of Edinburgh, 1993.Google Scholar
  11. 11.
    A.J. Kfoury, J. Tiuryn, and P. Urcyczyn. The undecidability of the semi-unification problem. Information and Computation, 102(1):83–101, January 1993.Google Scholar
  12. 12.
    Xavier Leroy. Polymorphic typing of an algorithmic language. Rapports de Recherche No. 1778, INRIA, 1992.Google Scholar
  13. 13.
    Per Martin-Löf. An intuitionistic theory of types: predicative part. In Rose and Shepherdson, editors, Logic Colloquium 1973, pages 73–118. North-Holland, 1975.Google Scholar
  14. 14.
    Robin Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17:348–375, 1978.Google Scholar
  15. 15.
    Robin Milner and Mads Tofte. Commentary on Standard ML. MIT Press, 1991.Google Scholar
  16. 16.
    Robin Milner, Mads Tofte, and Robert Harper. The Definition of Standard ML. MIT Press, 1990.Google Scholar
  17. 17.
    Laurence C. Paulson. ML for the Working Programmer. Cambridge University Press, 1991.Google Scholar
  18. 18.
    Stefan Sokolowski. Applicative High Order Programming. Chapman & Hall Computing, 1991.Google Scholar
  19. 19.
    Philip Wadler. The essence of functional programming. In 19th ACM Symposion on Principles of Programming Languages, pages 1–14, 1992.Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 1994

Authors and Affiliations

  • Stefan Kahrs
    • 1
  1. 1.Laboratory for Foundations of Computer ScienceUniversity of Edinburgh

Personalised recommendations