Skip to main content

Type Processing by Constraint Reasoning

  • Conference paper
Programming Languages and Systems (APLAS 2006)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 4279))

Included in the following conference series:

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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)

    Chapter  Google Scholar 

  2. Beaven, M., Stansifer, R.: Explaining type errors in polymorphic languages. ACM Letters on Programming Languages 2, 17–30 (1993)

    Article  Google Scholar 

  3. Cheney, J., Hinze, R.: First-class phantom types. Technical Report CUCIS TR2003-1901, Cornell University (2003)

    Google Scholar 

  4. 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)

    Chapter  Google Scholar 

  5. 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)

    Google Scholar 

  6. 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)

    Chapter  Google Scholar 

  7. Duggan, D., Bent, F.: Explaining type inference. Science of Computer Programming 27(1), 37–83 (1996)

    Article  MATH  Google Scholar 

  8. Frühwirth, T.: Constraint handling rules. In: Podelski, A. (ed.) Constraint Programming: Basics and Trends. LNCS, vol. 910. Springer, Heidelberg (1995)

    Google Scholar 

  9. 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)

    Chapter  Google Scholar 

  10. 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)

    Chapter  Google Scholar 

  11. Haskell 98 language report, http://research.microsoft.com/Users/simonpj/haskell98-revised/haskell98-report-html/

  12. Heeren, B., Hage, J.: Parametric type inferencing for Helium. Technical Report UU-CS-2002-035, Utrecht University (2002)

    Google Scholar 

  13. 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)

    Chapter  Google Scholar 

  14. Heeren, B., Hage, J., Swierstra, D.: Generalizing Hindley-Milner type inference algorithms. Technical Report UU-CS-2002-031, Utrecht University (2002)

    Google Scholar 

  15. Helium home page, http://www.cs.uu.nl/~afie/helium/

  16. Hugs home page, http://www.haskell.org/hugs/

  17. Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, pp. 230–244. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  18. 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)

    Google Scholar 

  19. 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)

    Chapter  Google Scholar 

  20. Marriott, K., Stuckey, P.J.: Programming with Constraints: an Introduction. MIT Press, Cambridge (1998)

    MATH  Google Scholar 

  21. McAdam, B.J.: Generalising techniques for type debugging. Trends in Functional Programming, 49–57 (March 2000)

    Google Scholar 

  22. Milner, R.: A theory of type polymorphism in programming. Journal of Computer and System Sciences 17, 348–375 (1978)

    Article  MATH  MathSciNet  Google Scholar 

  23. nhc98 home page, haskell.org/nhc98/

  24. 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)

    Chapter  Google Scholar 

  25. Pottier, F., Gauthier, N.: Polymorphic typed defunctionalization. In: Proc. of POPL 2004, pp. 89–98. ACM Press, New York (2004)

    Chapter  Google Scholar 

  26. Sheard, T., Pasalic, E.: Meta-programming with built-in type equality. In: Fourth International Workshop on Logical Frameworks and Meta-Languages (2004)

    Google Scholar 

  27. Shoenfield, J.R.: Mathematical Logic. Addison-Wesley, Reading (1967)

    MATH  Google Scholar 

  28. Stuckey, P.J., Sulzmann, M.: A theory of overloading. ACM Transactions on Programming Languages and Systems 27(6), 1216–1269 (2005)

    Article  Google Scholar 

  29. 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

  30. 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)

    Chapter  Google Scholar 

  31. 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)

    Chapter  Google Scholar 

  32. Sulzmann, M., Wazny, J.: Chameleon, http://www.comp.nus.edu.sg/~sulzmann/chameleon

  33. 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)

    Chapter  Google Scholar 

  34. 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)

    Google Scholar 

  35. 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

  36. Xi, H., Chen, C., Chen, G.: Guarded recursive datatype constructors. In: Proc. of POPL 2003, pp. 224–235. ACM Press, New York (2003)

    Chapter  Google Scholar 

  37. 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)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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)

Publish with us

Policies and ethics