Type inference with subtypes
•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.
- [Car84]L Cardelli. A semantics of multiple inheritance. In Semantics of Data Types: LNCS 173, 1984.Google Scholar
- [Car85]L Cardelli. Basic polymorphic typechecking. 1985. Manuscript.Google Scholar
- [DM82]L Damas and R. Milner. Principal type schemes for functional programs. In POPL IX, 1982.Google Scholar
- [Lei83]D Leivant. Polymorphic type inference. In POPL X, 1983.Google Scholar
- [Mal87]J Malhotra. Implementation Issues for Standard ML. Master's thesis, SUNY at Stony Brook, August 1987.Google Scholar
- [Mit84a]J. C. Mitchell. Coercion and type inference. In POPL XI, 1984.Google Scholar
- [Mit84b]J. C. Mitchell. Type inference and type containment. In Semantics of Data Types: LNCS 173, 1984.Google Scholar
- [MM82]A Martelli and U Montanari. An efficient unification algorithm. TOPLAS, 4(2), 1982.Google Scholar
- [MR85]P Mishra and U.S Reddy. Declaration-free type inference. In POPL XII, 1985.Google Scholar
- [Rey70]J. C. Reynolds. Transformational systems and the algebraic structure of atomic formulas. In Machine Intelligence 5, 1970.Google Scholar
- [Rey80]J. C. Reynolds. Using category theory to design implicit conversions and generic operators. In Semantics-Directed Compiler Generation: LNCS 94, 1980.Google Scholar
- [Rey85]J. C. Reynolds. Three approaches to type structure. In TAPSOFT 1985: LNCS 186, 1985.Google Scholar
- [Wan87a]M. Wand. Complete type inference for simple objects. In LICS II, 1987.Google Scholar
- [Wan87b]M Wand. A simple algorithm and proof for type inference. 1987. Manuscript.Google Scholar