Haskell Type Constraints Unleashed

  • Dominic Orchard
  • Tom Schrijvers
Part of the Lecture Notes in Computer Science book series (LNCS, volume 6009)


The popular Glasgow Haskell Compiler extends the Haskell 98 type system with several powerful features, leading to an expressive language of type terms. In contrast, constraints over types have received much less attention, creating an imbalance in the expressivity of the type system. In this paper, we rectify the imbalance, transferring familiar type-level constructs, synonyms and families, to the language of constraints, providing a symmetrical set of features at the type-level and constraint-level. We introduce constraint synonyms and constraint families, and illustrate their increased expressivity for improving the utility of polymorphic EDSLs in Haskell, amongst other examples. We provide a discussion of the semantics of the new features relative to existing type system features and similar proposals, including details of termination.


Type Class Type Family Call Graph Type Term Constraint Language 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Peyton Jones, S., et al.: Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003)Google Scholar
  2. 2.
    Chakravarty, M.M.T., Keller, G., Jones, S.P.: Associated type synonyms. In: ICFP 2005: Proceedings of the tenth ACM SIGPLAN international conference on Functional programming, pp. 241–253. ACM, New York (2005)CrossRefGoogle Scholar
  3. 3.
    Chakravarty, M.M.T., Keller, G., Jones, S.P., Marlow, S.: Associated types with class. SIGPLAN Not. 40(1), 1–13 (2005)CrossRefGoogle Scholar
  4. 4.
    Schrijvers, T., Jones, S.P., Chakravarty, M., Sulzmann, M.: Type checking with open type functions. SIGPLAN Not. 43(9), 51–62 (2008)CrossRefGoogle Scholar
  5. 5.
    Stewart, D.: Domain Specific Languages for Domain Specific Problems. In: Workshop on Non-Traditional Programming Models for High-Performance Computing, LACSS (2009)Google Scholar
  6. 6.
    Meacham, J.: Class Alias Proposal for Haskell, (last visited August 2009)
  7. 7.
    Jeltsch, W., van Dijk, B., van Dijk, R.: HaskellWiki: Context alias entry, (last visited August 2009)
  8. 8.
    Chakravarty, M., Peyton Jones, S., Sulzmann, M., Schrijvers, T.: GHC developer wiki: Class families entry, (last visited August 2009)
  9. 9.
    Schrijvers, T., Stuckey, P., Wadler, P.: Monadic Constraint Programming. J. Func. Prog. 19(6), 663–697 (2009)zbMATHCrossRefMathSciNetGoogle Scholar
  10. 10.
    Carette, J., Kiselyov, O., Shan, C.: Finally Tagless, Partially Evaluated. In: Shao, Z. (ed.) APLAS 2007. LNCS, vol. 4807, pp. 222–238. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  11. 11.
    Kiselyov, O.: Restricted Data Types Now (February 2006),
  12. 12.
    Sulzmann, M., Duck, G.J., Peyton-Jones, S., Stuckey, P.J.: Understanding functional dependencies via constraint handling rules. J. Func. Prog. 17, 83–129 (2007)zbMATHCrossRefGoogle Scholar
  13. 13.
    Orchard, D., Schrijvers, T.: Haskell Type Constraints Unleashed: Companion Report. Report CW 574, Dept. of Computer Science, K.U. Leuven, Belgium (January 2010)Google Scholar
  14. 14.
    Diatchki, I.S.: High-Level Abstractions for Low-Level Programming. PhD thesis, OGI School of Science & Engineering at Oregon Health & Science University (May 2007)Google Scholar
  15. 15.
    Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, p. 230. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  16. 16.
    Hughes, J.: Restricted Data Types in Haskell. In: Proceedings of the 1999 Haskell Workshop. Technical Report UU-CS-1999-28, Utrecht (1999)Google Scholar
  17. 17.
    Sittampalam, G., Gavin, P.: Rmonad: Restricted monad library (2008),
  18. 18.
    Bolingbroke, M.: Constraint families (2009),

Copyright information

© Springer-Verlag Berlin Heidelberg 2010

Authors and Affiliations

  • Dominic Orchard
    • 1
  • Tom Schrijvers
    • 2
  1. 1.Computer LaboratoryUniversity of Cambridge 
  2. 2.Katholieke Universiteit Leuven 

Personalised recommendations