Abstract
Herbrand constraint solving or unification has long been understood as an efficient mechanism for type checking and inference for programs using Hindley/Milner types. If we step back from the particular solving mechanisms used for Hindley/Milner types, and understand type operations in terms of constraints we not only give a basis for handling Hindley/Milner extensions, but also gain insight into type reasoning even on pure Hindley/Milner types, particularly for type errors. In this paper we consider typing problems as constraint problems and show which constraint algorithms are required to support various typing questions. We use a light weight constraint reasoning formalism, Constraint Handling Rules, to generate suitable algorithms for many popular extensions to Hindley/Milner types. The algorithms we discuss are all implemented as part of the freely available Chameleon system.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Abdennadher, S.: Operational semantics and confluence of constraint propagation rules. In: Smolka, G. (ed.) CP 1997. LNCS, vol. 1330, pp. 252–266. Springer, Heidelberg (1997)
Beaven, M., Stansifer, R.: Explaining type errors in polymorphic languages. ACM Letters on Programming Languages 2, 17–30 (1993)
Cheney, J., Hinze, R.: First-class phantom types. Technical Report CUCIS TR2003-1901, Cornell University (2003)
Chitil, O.: Compositional explanation of types and algorithmic debugging of type errors. In: Proc. of ICFP 2001, pp. 193–204. ACM Press, New York (2001)
Demoen, B., de la Banda, M.G., Stuckey, P.J.: Type constraint solving for parametric and ad-hoc polymorphism. In: Proc. of the 22nd Australian Computer Science Conference, pp. 217–228. Springer, Heidelberg (1999)
Duck, G.J., Peyton-Jones, S., Stuckey, P.J., Sulzmann, M.: Sound and decidable type inference for functional dependencies. In: Schmidt, D. (ed.) ESOP 2004. LNCS, vol. 2986, pp. 49–63. Springer, Heidelberg (2004)
Duggan, D., Bent, F.: Explaining type inference. Science of Computer Programming 27(1), 37–83 (1996)
Frühwirth, T.: Constraint handling rules. In: Podelski, A. (ed.) Constraint Programming: Basics and Trends. LNCS, vol. 910. Springer, Heidelberg (1995)
de la Banda, M.G., Stuckey, P.J., Wazny, J.: Finding all minimal unsatisfiable constraints. In: Proc. of PPDP 2003, pp. 32–43. ACM Press, New York (2003)
Haack, C., Wells, J.B.: Type error slicing in implicitly typed higher-order languages. In: Degano, P. (ed.) ESOP 2003. LNCS, vol. 2618, pp. 284–301. Springer, Heidelberg (2003)
Haskell 98 language report, http://research.microsoft.com/Users/simonpj/haskell98-revised/haskell98-report-html/
Heeren, B., Hage, J.: Parametric type inferencing for Helium. Technical Report UU-CS-2002-035, Utrecht University (2002)
Heeren, B., Hage, J.: Type class directives. In: Hermenegildo, M.V., Cabeza, D. (eds.) PADL 2004. LNCS, vol. 3350, pp. 253–267. Springer, Heidelberg (2005)
Heeren, B., Hage, J., Swierstra, D.: Generalizing Hindley-Milner type inference algorithms. Technical Report UU-CS-2002-031, Utrecht University (2002)
Helium home page, http://www.cs.uu.nl/~afie/helium/
Hugs home page, http://www.haskell.org/hugs/
Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 230–244. Springer, Heidelberg (2000)
Lee, O., Yi, K.: A generalized let-polymorphic type inference algorithm. Technical Memorandum ROPAS-2000-5, National Creative Research Center, Korea Advanced Institute of Science and Technology (March 2000)
Maher, M.J.: Herbrand constraint abduction. In: 20th IEEE Symposium on Logic in Computer Science (LICS 2005), pp. 397–406. IEEE Computer Society Press, Los Alamitos (2005)
Marriott, K., Stuckey, P.J.: Programming with Constraints: an Introduction. MIT Press, Cambridge (1998)
McAdam, B.J.: Generalising techniques for type debugging. Trends in Functional Programming, 49–57 (March 2000)
Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17, 348–375 (1978)
nhc98 home page, haskell.org/nhc98/
Nilsson, H.: Dynamic optimization for functional reactive programming using generalized algebraic data types. In: Proc. of ICFP 2005, pp. 54–65. ACM Press, New York (2005)
Pottier, F., Gauthier, N.: Polymorphic typed defunctionalization. In: Proc. of POPL 2004, pp. 89–98. ACM Press, New York (2004)
Sheard, T., Pasalic, E.: Meta-programming with built-in type equality. In: Fourth International Workshop on Logical Frameworks and Meta-Languages (2004)
Shoenfield, J.R.: Mathematical Logic. Addison-Wesley, Reading (1967)
Stuckey, P.J., Sulzmann, M.: A theory of overloading. ACM Transactions on Programming Languages and Systems 27(6), 1216–1269 (2005)
Stuckey, P.J., Sulzmann, M., Wazny, J.: The Chameleon type debugger (tool demonstration). In: Ronsse, M. (ed.) Proceedings of the Fifth International Workshop on Automated Debugging, pp. 247–260 (2003), http://arxiv.org/html/cs.SE/0309027
Stuckey, P.J., Sulzmann, M., Wazny, J.: Interactive type debugging in Haskell. In: Juring, J. (ed.) Proceedings of the ACM SIGPLAN 2003 Haskell Workshop, pp. 72–83. ACM Press, New York (2003)
Stuckey, P.J., Sulzmann, M., Wazny, J.: Improving type error diagnosis. In: Proceedings of the ACM SIGPLAN 2004 Haskell Workshop, pp. 80–91. ACM Press, New York (2004)
Sulzmann, M., Wazny, J.: Chameleon, http://www.comp.nus.edu.sg/~sulzmann/chameleon
Sulzmann, M., Wazny, J., Stuckey, P.J.: A framework for extended algebraic data types. In: Hagiya, M., Wadler, P. (eds.) FLOPS 2006. LNCS, vol. 3945, pp. 47–64. Springer, Heidelberg (2006)
Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad-hoc. In: Proc. of POPL 1989, pp. 60–76. ACM Press, New York (1989)
Wazny, J.: Type inference and type error diagnosis for Hindley/Milner with extensions. PhD thesis, University of Melbourne (2006), http://www.comp.nus.edu.sg/~sulzmann/chameleon/thesis.ps.gz
Xi, H., Chen, C., Chen, G.: Guarded recursive datatype constructors. In: Proc. of POPL 2003, pp. 224–235. ACM Press, New York (2003)
Yang, J., Wells, J., Trinder, P., Michaelson, G.: Improved type error reporting. In: Proceedings of 12th International Workshop on Implementation of Functional Languages, pp. 71–86 (2000)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2006 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Stuckey, P.J., Sulzmann, M., Wazny, J. (2006). Type Processing by Constraint Reasoning. In: Kobayashi, N. (eds) Programming Languages and Systems. APLAS 2006. Lecture Notes in Computer Science, vol 4279. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11924661_1
Download citation
DOI: https://doi.org/10.1007/11924661_1
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-48937-5
Online ISBN: 978-3-540-48938-2
eBook Packages: Computer ScienceComputer Science (R0)