Skip to main content Accessibility help
×
Home
Hostname: page-component-768dbb666b-x9ds4 Total loading time: 0.296 Render date: 2023-02-04T07:11:41.468Z Has data issue: true Feature Flags: { "useRatesEcommerce": false } hasContentIssue true

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

HTML view is 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.
You have Access
7
Cited by

Save article to Kindle

To save this article to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about saving to your Kindle.

Note you can select to save to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be saved to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

Find out more about the Kindle Personal Document Service.

Type-safe pattern combinators
Available formats
×

Save article to Dropbox

To save this article to your Dropbox account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you used this feature, you will be asked to authorise Cambridge Core to connect with your Dropbox account. Find out more about saving content to Dropbox.

Type-safe pattern combinators
Available formats
×

Save article to Google Drive

To save this article to your Google Drive account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you used this feature, you will be asked to authorise Cambridge Core to connect with your Google Drive account. Find out more about saving content to Google Drive.

Type-safe pattern combinators
Available formats
×
×

Reply to: Submit a response

Please enter your response.

Your details

Please enter a valid email address.

Conflicting interests

Do you have any conflicting interests? *