Abstract
We extend polymorphic type inference to include subtypes. This paper describes the following results:
-
•We prove the existence of (i) principal type property and (ii) syntactic completeness of the type checker, for type inference with subtypes. This result is developed with only minimal assumptions on the underlying theory of subtypes.
-
•For a particular “structured” theory of subtypes, those engendered by coercions between type constants only, we prove that principal types are compactly expressible. This suggests that a practical type checker for the structured theory of subtypes is feasible.
-
•We develop efficient algorithms for such a type checker. There are two main algorithms: MATCH and CONSISTENT. The first can be thought of as an extension to the unification algorithm. The second, which has no analogue in conventional type inference, determines whether a set of coercions is consistent.
Thus, an extension of polymorphic type inference that incorporates the “structured” theory of subtypes is practical and yields greater polymorphic flexibility. We have begun work on an implementation.
Chapter PDF
Similar content being viewed by others
References
L Cardelli. A semantics of multiple inheritance. In Semantics of Data Types: LNCS 173, 1984.
L Cardelli. Basic polymorphic typechecking. 1985. Manuscript.
L Damas and R. Milner. Principal type schemes for functional programs. In POPL IX, 1982.
D Leivant. Polymorphic type inference. In POPL X, 1983.
J Malhotra. Implementation Issues for Standard ML. Master's thesis, SUNY at Stony Brook, August 1987.
J. C. Mitchell. Coercion and type inference. In POPL XI, 1984.
J. C. Mitchell. Type inference and type containment. In Semantics of Data Types: LNCS 173, 1984.
A Martelli and U Montanari. An efficient unification algorithm. TOPLAS, 4(2), 1982.
P Mishra and U.S Reddy. Declaration-free type inference. In POPL XII, 1985.
J. C. Reynolds. Transformational systems and the algebraic structure of atomic formulas. In Machine Intelligence 5, 1970.
J. C. Reynolds. Using category theory to design implicit conversions and generic operators. In Semantics-Directed Compiler Generation: LNCS 94, 1980.
J. C. Reynolds. Three approaches to type structure. In TAPSOFT 1985: LNCS 186, 1985.
M. Wand. Complete type inference for simple objects. In LICS II, 1987.
M Wand. A simple algorithm and proof for type inference. 1987. Manuscript.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1988 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Fuh, YC., Mishra, P. (1988). Type inference with subtypes. In: Ganzinger, H. (eds) ESOP '88. ESOP 1988. Lecture Notes in Computer Science, vol 300. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-19027-9_7
Download citation
DOI: https://doi.org/10.1007/3-540-19027-9_7
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-19027-1
Online ISBN: 978-3-540-38941-5
eBook Packages: Springer Book Archive