Skip to main content Accessibility help

HM(X) type inference is CLP(X) solving


The HM(X) system is a generalization of the Hindley/Milner system parameterized in the constraint domain X. Type inference is performed by generating constraints out of the program text, which are then solved by the domain-specific constraint solver X. The solver has to be invoked at the latest when type inference reaches a let node so that we can build a polymorphic type. A typical example of such an inference approach is Milner's algorithm W. We formalize an inference approach where the HM(X) type inference problem is first mapped to a CLP(X) program. The actual type inference is achieved by executing the CLP(X) program. Such an inference approach supports the uniform construction of type inference algorithms and has important practical consequences when it comes to reporting type errors. The CLP(X) style inference system, where X is defined by Constraint Handling Rules, is implemented as part of the Chameleon system.

Hide All
Aiken, A. & Wimmers, E. L. (1992) Solving systems of set constraints. In Seventh IEEE Symposium on Logic in Computer Science, Santa Cruz, CA. Los Alamitos, CA: IEEE Computer Society Press, pp. 320340.
Alves, S. & Florido, M. (2002) Type inference using constraint handling rules. Electr. Notes Theor. Comput. Sci. 64.
Birkedal, L. & Tofte, M. (2001) A constraint-based region inference algorithm. Theor. Comput. Sci. 258 (1–2), 299392.
Coquery, E. & Fages, F. (2002) TCLP: Overloading, subtyping and parametric polymorphism made practical for CLP. In Proc. of ICLP '02, vol. 2401. Berlin: Springer-Verlag.
Damas, L. & Milner, R. (1982) Principal type-schemes for functional programs. In Proc. of POPL'82. New York: ACM Press, pp. 207212.
Demoen, B., Garcíade la Banda, M. de la Banda, M. & Stuckey, P. J. (1999) Type constraint solving for parametric and ad-hoc polymorphism. In Proc. of the 22nd Australian Computer Science Conference. Berlin: Springer-Verlag, pp. 217228.
Dietzen, S. & Pfenning, F. (1991) A declarative alternative to “assert'' in logic programming. In Proc. of ISLP'91, pp. 372–386.
Eo, H., Lee, O. & Yi, K. (2003) Proofs of a set of hybrid let-polymorphic type inference algorithms. New Generation Comput. 22 (1), 136.
Fordan, A. & Yap, R. H. C. (1998) Early projection in CLP(R). In CP'98: Proceedings of the 4th International Conference on Principles and Practice of Constraint Programming. London, UK: Springer-Verlag, pp. 177191.
Frühwirth, T. (1995) Constraint handling rules. In Constraint Programming: Basics and Trends. LNCS. Berlin: Springer-Verlag, pp. 90107.
Fuh, Y.-C. & Mishra, P. (1990) Type inference with subtypes. Theor. Comput. Sci. 73, 155175.
Glynn, K., Stuckey, P. J. & Sulzmann, M. (2000) Type classes and constraint handling rules. In Workshop on Rule-Based Constraint Reasoning and Programming. Available at: Accessed August 2007.
Henglein, F. (1992) Simple Closure Analysis. DIKU Semantics Report D-193. University of Copenhagen.
Henglein, F. (1993) Type inference with polymorphic recursion. Trans. Programming Lang Syst. 15 (1), 253289.
Henkin, L., Monk, J. D. & Tarski, A. (1971) Cylindric Algebra. Amsterdam: North-Holland Publishing Company.
Jaffar, J. & Lassez, J-L. (1987) Constraint logic programming. In Proc. of POPL'87, pp. 111–119.
Jaffar, J., Maher, M., Marriott, K. & Stuckey, P.J. (1998) The semantics of constraint logic programs. J. Logic Programming 37 (1–3), 146.
Kanellakis, P. C., Mairson, H. G. & Mitchell, J. C. (1991) Unification and ML-type reconstruction. In Computational logic-Essays in Honor of Alan Robinson. Cambridge, Mass.: MIT Press, pp. 444478.
Kennedy, A. J. (1996) Type Inference and Equational Theories. Tech. rept. LIX/RR/96/09. LIX, Ecole Polytechnique, 91128 Palaiseau Cedex, France.
Lakshman, T. L. & Reddy, U S. (1991) Typed Prolog: A semantic reconstruction of the Mycroft-O'Keefe type system. In Proc. of ISLP'91. Cambridge, Mass.: MIT Press, pp. 202217.
Lee, O. & Yi, K. (1998) Proofs about a folklore let-polymorphic type inference algorithm. ACM Trans. Programming Lang. Syst., 20 (4), 707723.
Liang, C. (1997) Let-polymorphism and eager type schemes. In TAPSOFT '97: Proceedings of the 7th International Joint Conference CAAP/FASE on Theory and Practice of Software Development. Springer-Verlag, pp. 490–501.
Maher, M. (1988) Complete axiomatizations of the algebras of finite, rational and infinite trees. In Proc. 3rd Logic in Computer Science Conference, pp. 348–357.
McAllester, D. A. (2003) Joint RTA-TLCA invited talk: A logical algorithm for ML type inference. In Proc. of RTA'03. LNCS, Vol. 2706. Berlin: Springer-Verlag, pp. 436451.
Milner, R. (1978) A theory of type polymorphism in programming. J. Comput. Syst. Sci. 17, 348375.
Mitchell, J. (2002) Concepts of Programming Languages. Cambridge University Press.
Müller, M. (1994) A constraint-based recast of ML-polymorphism. In 8th International Workshop on Unification. Also available as Technical Report 94-R-43, Université de Nancy.
Mycroft, A. & O'Keefe, R. (1984) A polymorphic type system for Prolog. Artif. Intelligence 23, 295307.
Nadathur, G. & Miller, D. (1988) An overview of λprolog. In Fifth International Conference and Symposium on Logic Programming, Bowen, K. & Kowalski, R. (eds). MIT Press.
Odersky, M., Sulzmann, M. & Wehr, M. (1999) Type inference with constrained types. Theory Pract. Object Syst., 5 (1), 3555.
Palsberg, J. & Smith, S. (1996) Constrained types and their expressiveness. ACM Trans. Programming Lang. Syst. 18 (5), 519527.
PeytonJones, S. Jones, S. (ed). (2003) Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press.
Pottier, F. (1998) A framework for type inference with subtyping. In Proc. of ICFP'98. ACM Press, pp. 228238.
Pottier, F. & Rémy, D. (2005) The essence of ML type inference. Advanced Topics in Types and Programming Languages, Pierce, B. C. (ed). Cambridge, Mass.: MIT Press, Chap. 10, pp. 389489.
Rémy, D. (1993) Type inference for records in a natural extension of ML. In Theoretical Aspects of Object-Oriented Programming. Types, Semantics and Language Design, Chapter 3. Gunter, C. A. & Mitchell, J. C. (eds), MIT Press.
Robinson, J. A. (1965) A machine-oriented logic based on the resolution principle. J. ACM 12, 2341.
Stuckey, P. J. & Sulzmann, M. (2005) A theory of overloading. ACM Trans. Programming Lang. syst. (TOPLAS) 27 (6), 154.
Stuckey, P. J., Sulzmann, M. & Wazny, J. (2003a) The Chameleon type debugger. In Proc. of Fifth International Workshop on Automated Debugging (AADEBUG 2003). Computer Research Repository. Available at:
Stuckey, P. J., Sulzmann, M. & Wazny, J. (2003b) Interactive type debugging in Haskell. In Proc. of Haskell'03. New York: ACM Press, pp. 7283.
Stuckey, P. J., Sulzmann, M. & Wazny, J. (2004) Improving type error diagnosis. In Proc. of Haskell'04. New York: ACM Press, pp. 8091.
Stuckey, P. J., Sulzmann, M. & Wazny, J. (2006) Type processing by constraint reasoning. Proc. of APLAS'06. LNCS, Vol. 4279, Berlin: Springer-Verlag, pp. 1–25.
Sulzmann, M. (2000) A General Framework for Hindley/Milner Type Systems With Constraints. Ph.D. thesis, Department of Computer Science, Yale University.
Sulzmann, M. (2001) A general type inference framework for Hindley/Milner style systems. In Proc. of FLOPS'01. LNCS, Vol. 2024. Berlin: Springer-Verlag, pp. 246–263.
Sulzmann, M., Müller, M. & Zenger, C. (1999) Hindley/Milner Style Type Systems in Constraint Form. Research Report ACRC-99-009. University of South Australia, School of Computer and Information Science.
Sulzmann, M., Odersky, M. & Wehr, M. (1997) Type inference with constrained types. In FOOL4: 4th Int. Workshop on Foundations of Object-Oriented Programming Languages.
Sulzmann, M. & Wazny, J. (2007) Chameleon. Available at Accessed August 2007.
Urban, C., Pitts, A. M. & Gabbay, M. J. (2004) Nominal unification. Theor. Comput. Sci. 323 (1-3), 473497.
Wadler, P. & Blott, S. (1989) How to make ad-hoc polymorphism less ad-hoc. In Proc. of POPL '89. New York: ACM Press, pp. 6076.
Zenger, C. (1999) Indizierte Typen. Ph.D. thesis, Universität Karlsruhe, Germany.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *


Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed

HM(X) type inference is CLP(X) solving

Submit a response


No Discussions have been published for this article.


Reply to: Submit a response

Your details

Conflicting interests

Do you have any conflicting interests? *