The Essence of ML

J.C. Mitchell and R. Harper

Abstract: Standard ML is a useful programming language
with polymorphic expressions and a flexible module facility. One
notable feature of the expression language is an algorithm which
allows type information to be omitted. We study the
implicitly-typed expression language by giving a ``syntactically
isomorphic'' explicitly-typed, polymorphic function calculus.
Unlike the Girard-Reynolds polymorphic calculus, for example, the
types of our ML calculus may be built-up by induction on type
levels (universes). For this reason, the pure ML calculus
has straightforward set-theoretic, recursion-theoretic and
domain-theoretic semantics, and operational properties such as the
termination of all recursion-free programs may be proved relatively
simply. The signatures, structures, and
functors of the module language are easily incorporated into
the typed ML calculus, providing a unified framework for studying
the major features of the language (including the novel ``sharing
constraints'' on functor parameters). We show that, in a precise
sense, the language becomes inconsistent if restrictions imposed by
type levels are relaxed. More specifically, we prove that the
important programming features of ML cannot be added to any
impredicative language, such as the Girard-Reynolds calculus,
without implicitly assuming a type of all types.