Skip to main content

Type-safe pattern combinators


Macros still haven't made their way into typed higher-order programming languages such as Haskell and Standard ML. Therefore, to extend the expressiveness of Haskell or Standard ML, one must express new linguistic features in terms of functions that fit within the static type systems of these languages. This is particularly challenging when introducing features that span across multiple types and that bind variables. We address this challenge by developing, in a step by step manner, mechanisms for encoding patterns and pattern matching in Haskell in a type-safe way.

Hide All
Danvy, O. (1998) Functional unparsing. J. Funct. Prog. 8 (6), 621625.
Fähndrich, M. & Boyland, J. (1997) Statically checkable pattern abstractions. Pages 75–84 of: Mads, Tofte (ed), Proceedings of the 1997 ACM SIGPLAN international conference on functional programming (ICFP 1997). Amsterdam, The Netherlands: ACM Press.
Filinski, A. (1999) A semantic account of type-directed partial evaluation. In: International conference on principles and practice of declarative programming (PPDP 1999), Nadathur, G. (ed). Lecture Notes in Computer Science, vol. 1702. Paris, France: Springer-Verlag, pp. 378395.
Fridlender, D. & Indrika, M. (2000) Do we need dependent types? J. Funct. Prog. 10 (4), 409415.
Rhiger, M. (1999) Deriving a statically typed type-directed partial evaluator. In: Proceedings of the ACM SIGPLAN workshop on partial evaluation and semantics-based program manipulation (PEPM 1999), Danvy, O. (ed). BRICS Note Series, no. NS–99–1, Department of Computer Science, University of Aarhus, Denmark, pp. 25–29.
Steele, G. L. Jr. (1999) Growing a language. Higher-Order Symb. Comput. 12 (3), 221236.
Wadler, P. (1987) Views: A way for pattern matching to cohabit with data abstraction. In: Proceedings of the fourteenth annual ACM symposium on principles of programming languages (POPL 1987), O'Donnell, M. J. (ed). Munich, West Germany: ACM Press, pp. 307313.
Yang, Z. (2004) Encoding types in ML-like languages. Theoret. Comput. Sci. 315 (1), 151190.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *


Full text views

Total number of HTML views: 0
Total number of PDF views: 23 *
Loading metrics...

Abstract views

Total abstract views: 147 *
Loading metrics...

* Views captured on Cambridge Core between September 2016 - 25th June 2018. This data will be updated every 24 hours.

Type-safe pattern combinators

Submit a response


No Discussions have been published for this article.


Reply to: Submit a response

Your details

Conflicting interests

Do you have any conflicting interests? *