Abstract
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.
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
Peyton Jones, S., et al.: Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003)
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)
Chakravarty, M.M.T., Keller, G., Jones, S.P., Marlow, S.: Associated types with class. SIGPLAN Not. 40(1), 1–13 (2005)
Schrijvers, T., Jones, S.P., Chakravarty, M., Sulzmann, M.: Type checking with open type functions. SIGPLAN Not. 43(9), 51–62 (2008)
Stewart, D.: Domain Specific Languages for Domain Specific Problems. In: Workshop on Non-Traditional Programming Models for High-Performance Computing, LACSS (2009)
Meacham, J.: Class Alias Proposal for Haskell, http://repetae.net/recent/out/classalias.html (last visited August 2009)
Jeltsch, W., van Dijk, B., van Dijk, R.: HaskellWiki: Context alias entry, http://www.haskell.org/haskellwiki/Context_alias (last visited August 2009)
Chakravarty, M., Peyton Jones, S., Sulzmann, M., Schrijvers, T.: GHC developer wiki: Class families entry, http://hackage.haskell.org/trac/ghc/wiki/TypeFunctions/ClassFamilies (last visited August 2009)
Schrijvers, T., Stuckey, P., Wadler, P.: Monadic Constraint Programming. J. Func. Prog. 19(6), 663–697 (2009)
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)
Kiselyov, O.: Restricted Data Types Now (February 2006), http://okmij.org/ftp/Haskell/RestrictedMonad.lhs
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)
Orchard, D., Schrijvers, T.: Haskell Type Constraints Unleashed: Companion Report. Report CW 574, Dept. of Computer Science, K.U. Leuven, Belgium (January 2010)
Diatchki, I.S.: High-Level Abstractions for Low-Level Programming. PhD thesis, OGI School of Science & Engineering at Oregon Health & Science University (May 2007)
Jones, M.P.: Type classes with functional dependencies. In: Smolka, G. (ed.) ESOP 2000. LNCS, vol. 1782, p. 230. Springer, Heidelberg (2000)
Hughes, J.: Restricted Data Types in Haskell. In: Proceedings of the 1999 Haskell Workshop. Technical Report UU-CS-1999-28, Utrecht (1999)
Sittampalam, G., Gavin, P.: Rmonad: Restricted monad library (2008), http://hackage.haskell.org/package/rmonad
Bolingbroke, M.: Constraint families (2009), http://blog.omega-prime.co.uk/?p=61
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2010 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Orchard, D., Schrijvers, T. (2010). Haskell Type Constraints Unleashed. In: Blume, M., Kobayashi, N., Vidal, G. (eds) Functional and Logic Programming. FLOPS 2010. Lecture Notes in Computer Science, vol 6009. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-12251-4_6
Download citation
DOI: https://doi.org/10.1007/978-3-642-12251-4_6
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-642-12250-7
Online ISBN: 978-3-642-12251-4
eBook Packages: Computer ScienceComputer Science (R0)