Abstract
We propose a constraint-based formulation of Hindley/Milner style type inference system as opposed to the standard substitution-based formulation. This allows us to make important distinctions between different phases of type inference: Constraint generation/propagation, constraint solving, constraint simplification and term reconstruction. The inference system is parametric in the constraint domain, covering a wide range of application domains. A problem, incompleteness of substitutionbased inference, identified by A. J. Kennedy can be solved naturally by employing a constraint-based view of type inference. In addition, our formulation of type inference can easily be tailored to different inference algorithms such as W and M. On the technical side, we present concise soundness and completeness results.
Acknowledgments
This work gained from fruitful discussions with Kevin Glynn, Peter Stuckey, Harald SØndergaard, Kwangkeun Yi and Christoph Zenger. Thanks goes also to the anonymous referres for their valuable feedback. In particular, I would like to thank Martin Müller for stimulating discussions about HM(X). He also contributed to the observation to separate the different type inference phases. Parts of this work were carried out while the author was at Yale University supported by DARPA Grant F30602-96-2-0232.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
A. Aiken and E. L. Wimmers. Type inclusion constraints and type inference. In FPCA ’93: Conference on Functional Programming Languages and Computer Architecture, Copenhagen, Denmark, pages 31–41, New York, June 1993. ACM Press.
L. Damas. Type Assignment in Programming Languages. PhD thesis, Edinburgh University, 1985.
D. Dussart, F. Henglein, and C. Mossin. Polymorphic recursion and subtype qualifications: Polymorphic binding-time analysis in polynomial time. In A. Mycroft, editor, Proc. Second Int. Symp. Static Analysis, volume 983 of Lecture Notes in Computer Science, pages 118–135. Springer-Verlag, 1995.
L. Damas and R. Milner. Principal type-schemes for functional programs. In Conference Record of the Ninth Annual ACM Symposium on Principles of Programming Languages, pages 207–212. ACM, ACM, January 1982.
A. J. Kennedy. Type inference and equational theories. Technical Report LIX/RR/96/09, LIX, Ecole Polytechnique, 91128 Palaiseau Cedex, France, September 1996.
_D. S. Lankford, G. Butler, and B. Brady. Abelian group unification algorithms for elementary terms. In W. Bledsoe and W. Loveland, editors, Automated Theorem Proving: After 25 Years. AMS, 1984.
O. Lee and K. Yi. Proofs about a folklore let-polymorphic type inference algorithm. ACM Transactions on Programming Languages and Systems, 20(4):707–723, 1998.
O. Lee and K. Yi. A generalized let-polymorphic type inference algorithm. Technical Memorandum ROPAS-2000-5, Research on Program Analysis System, Korea Advanced Institute of Science and Technology, March 2000.
R. Milner. A theory of type polymorphism in programming. Journal of Computer and System Sciences, 17:348–375, Dec 1978.
T. Nipkow and C. Prehofer. Type reconstruction for type classes. Journal of Functional Programming, 5(2):201–224, 1995.
A. Ohori. A polymorphic record calculus and its compilation. ACM TOPLAS, 6(6):805–843, November 1995.
M. Odersky, M. Sulzmann, and M Wehr. Type inference with constrained types. Theory and Practice of Object Systems, 5(1):35–55, 1999.
D. Rémy. Extending ML type system with a sorted equational theory. Technical Report 1766, INRIA, October 1992.
M. Sulzmann. A General Framework for Hindley/Milner Type Systems with Constraints. PhD thesis, Yale University, Department of Computer Science, May 2000.
M. Sulzmann. A general type inference framework for Hindley/Milner style systems. Technical report, Dept. of Computer Science and Software Engineering, The University of Melbourne, 2000. URL: http://www.cs.mu.oz.au/sulzmann/publications/inference.ps.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2001 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Sulzmann, M. (2001). A General Type Inference Framework for Hindley/Milner Style Systems. In: Kuchen, H., Ueda, K. (eds) Functional and Logic Programming. FLOPS 2001. Lecture Notes in Computer Science, vol 2024. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-44716-4_16
Download citation
DOI: https://doi.org/10.1007/3-540-44716-4_16
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-41739-2
Online ISBN: 978-3-540-44716-0
eBook Packages: Springer Book Archive