A Polymorphic Type System for Extensible Records and Variants

Records and variants provide flexible ways to construct datatypes, but the restrictions imposed by practical type systems can prevent them from being used in flexible ways. These limitations are often the result of concerns about eciency or type inference, or of the diculty in providing accurate types for key operations. This paper describes a new type system that remedies these problems: it supports extensible records and variants, with a full complement of polymorphic operations on each; and it oers an eective type inference algorithm and a simple compilation method. It is a practical system that can be understood and implemented as a natural extension of languages like Standard ML and Haskell. In an area that has already received a great deal of attention from the research community, the type system described here is the first to combine all of these features in a practical framework. One important aspect of this work is the emphasis that it places on the use of rows in the construction of record and variant types. As a result, with only small extensions of the core type system, we are able to introduce new, powerful operations on records using features such as row polymorphism and first-class labels.

[1]  J. A. Robinson,et al.  A Machine-Oriented Logic Based on the Resolution Principle , 1965, JACM.

[2]  R. Hindley The Principal Type-Scheme of an Object in Combinatory Logic , 1969 .

[3]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[4]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.

[5]  Luca Cardelli,et al.  A Semantics of Multiple Inheritance , 1984, Inf. Comput..

[6]  Mitchell Wand,et al.  Complete Type Inference for Simple Objects , 1987, LICS.

[7]  Peter Buneman,et al.  Type inference in a database programming language , 1988, LISP and Functional Programming.

[8]  M. Wand,et al.  Corrigendum: complete type interference for simple objects , 1988, [1988] Proceedings. Third Annual Information Symposium on Logic in Computer Science.

[9]  Mitchell Wand,et al.  Type inference for record concatenation and multiple inheritance , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[10]  Robin Milner,et al.  Definition of standard ML , 1990 .

[11]  Robert Harper,et al.  Extensible records without subsumption , 1990 .

[12]  Luca Cardelli,et al.  Operations on records , 1989, Mathematical Structures in Computer Science.

[13]  Benjamin C. Pierce,et al.  A record calculus based on symmetric concatenation , 1991, POPL '91.

[14]  Mitchell Wand,et al.  Type inference for record concatenation and multiple inheritance , 1989, [1989] Proceedings. Fourth Annual Symposium on Logic in Computer Science.

[15]  Didier Rémy,et al.  Typing record concatenation for free , 1992, POPL '92.

[16]  Simon L. Peyton Jones,et al.  Report on the programming language Haskell: a non-strict, purely functional language version 1.2 , 1992, SIGP.

[17]  Mark P. Jones A system of constructor classes: overloading and implicit higher-order polymorphism , 1993, FPCA '93.

[18]  Benjamin C. Pierce,et al.  Object-oriented programming without recursive types , 1993, POPL '93.

[19]  Xavier Leroy,et al.  Polymorphism by name for references and continuations , 1993, POPL '93.

[20]  John C. Mitchell,et al.  A lambda calculus of objects and method specialization , 1993, [1993] Proceedings Eighth Annual IEEE Symposium on Logic in Computer Science.

[21]  Luca Cardelli,et al.  Extensible records in a pure calculus of subtyping , 1994 .

[22]  Kim B. Bruce A paradigmatic object-oriented programming language: Design, static typing and semantics , 1994, Journal of Functional Programming.

[23]  Benjamin C. Pierce,et al.  Simple type-theoretic foundations for object-oriented programming , 1994, Journal of Functional Programming.

[24]  Martín Abadi,et al.  A semantics of object types , 1994, Proceedings Ninth Annual IEEE Symposium on Logic in Computer Science.

[25]  Didier Rémy,et al.  Programming Objects with ML-ART, an Extension to ML with Abstract and Record Types , 1994, TACS.

[26]  Didier Rémy,et al.  Type inference for records in natural extension of ML , 1994 .

[27]  John C. Mitchell,et al.  Theoretical aspects of object-oriented programming: types, semantics, and language design , 1994, Choice Reviews Online.

[28]  Mark P. Jones Qualified Types: Theory and Practice , 1994 .

[29]  Atsushi Ohori,et al.  A polymorphic record calculus and its compilation , 1995, TOPL.

[30]  Mark P. Jones,et al.  A system of constructor classes: overloading and implicit higher-order polymorphism , 1993, FPCA '93.

[31]  Graham Hutton,et al.  Bananas in space: extending fold and unfold to exponential types , 1995, FPCA '95.

[32]  Martin Hofmann,et al.  A unifying type-theoretic framework for objects , 1994, Journal of Functional Programming.

[33]  Andrew K. Wright Simple imperative polymorphism , 1995, LISP Symb. Comput..