Hostname: page-component-586b7cd67f-r5fsc Total loading time: 0 Render date: 2024-11-20T21:33:29.265Z Has data issue: false hasContentIssue false

Type-safe pattern combinators

Published online by Cambridge University Press:  01 March 2009

MORTEN RHIGER*
Affiliation:
The IT University of Copenhagen, Copenhagen, Denmark (e-mail: mir@itu.dk)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

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.

Type
Functional Pearls
Copyright
Copyright © Cambridge University Press 2008

References

Danvy, O. (1998) Functional unparsing. J. Funct. Prog. 8 (6), 621625.CrossRefGoogle Scholar
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.Google Scholar
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.CrossRefGoogle Scholar
Fridlender, D. & Indrika, M. (2000) Do we need dependent types? J. Funct. Prog. 10 (4), 409415.CrossRefGoogle Scholar
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.Google Scholar
Steele, G. L. Jr. (1999) Growing a language. Higher-Order Symb. Comput. 12 (3), 221236.CrossRefGoogle Scholar
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.Google Scholar
Yang, Z. (2004) Encoding types in ML-like languages. Theoret. Comput. Sci. 315 (1), 151190.CrossRefGoogle Scholar
Submit a response

Discussions

No Discussions have been published for this article.