Haskell Type Constraints Unleashed
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.
KeywordsType Class Type Family Call Graph Type Term Constraint Language
Unable to display preview. Download preview PDF.
- 1.Peyton Jones, S., et al.: Haskell 98 Language and Libraries: The Revised Report. Cambridge University Press, Cambridge (2003)Google Scholar
- 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.Meacham, J.: Class Alias Proposal for Haskell, http://repetae.net/recent/out/classalias.html (last visited August 2009)
- 7.Jeltsch, W., van Dijk, B., van Dijk, R.: HaskellWiki: Context alias entry, http://www.haskell.org/haskellwiki/Context_alias (last visited August 2009)
- 8.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)
- 11.Kiselyov, O.: Restricted Data Types Now (February 2006), http://okmij.org/ftp/Haskell/RestrictedMonad.lhs
- 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.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
- 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.Sittampalam, G., Gavin, P.: Rmonad: Restricted monad library (2008), http://hackage.haskell.org/package/rmonad
- 18.Bolingbroke, M.: Constraint families (2009), http://blog.omega-prime.co.uk/?p=61