Skip to main content

Bimonadic Semantics for Basic Pattern Matching Calculi

  • Conference paper
Mathematics of Program Construction (MPC 2006)

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 4014))

Included in the following conference series:

  • 529 Accesses

Abstract

The pattern matching calculi introduced by the first author are a refinement of the λ-calculus that integrates mechanisms appropriate for fine-grained modelling of non-strict pattern matching.

While related work in the literature only uses a single monad, typically Maybe, for matchings, we present an axiomatic approach to semantics of these pattern matching calculi using two monads, one for expressions and one for matchings.

Although these two monads only need to be relatively lightly coupled, this semantics implies soundness of all core PMC rules, and is a useful tool for exploration of the design space for pattern matching calculi.

Using lifting and Maybe monads, we obtain standard Haskell semantics, and by adding another level of Maybe to both, we obtain a denotational semantics of the “matching failure as exceptions” approach of Erwig and Peyton Jones. Using list-like monads opens up interesting extensions in the direction of functional-logic programming.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. Barr, M., Wells, C.: Category Theory for Computing Science, 3rd edn. Centre de recherches mathématiques (CRM), Université de Montréal (1999)

    Google Scholar 

  2. Carette, J., Kiselyov, O.: Multi-stage programming with functors and monads: eliminating abstraction overhead from generic code. In: Glück, R., Lowry, M. (eds.) GPCE 2005. LNCS, vol. 3676, pp. 256–274. Springer, Heidelberg (2005)

    Chapter  Google Scholar 

  3. Carette, J.: Gaussian elimination: a case study in efficient genericity with MetaOCaml. Sci. of Comput. Program (to appear)

    Google Scholar 

  4. Erwig, M., Peyton Jones, S.: Pattern guards and transformational patterns. In: Proc. of 2000 ACM SIGPLAN Haskell Wksh., Haskell 2000. Electron. Notes in Theor. Comput. Sci., vol. 41(1), p. 27 (2001)

    Google Scholar 

  5. Hanus, M.: A unified computation model for declarative programming. In: Proc. of 1997 APPIA-GULP-PRODE Joint Conf. on Declarative Programming, pp. 9–24 (1997)

    Google Scholar 

  6. Hanus, M., et al.: Curry—an integrated functional logic language, version 0.8.2 (2006), http://www.informatik.uni-kiel.de/~curry/report.html

  7. Harrison, W.L., Sheard, T., Hook, J.: Fine control of demand in Haskell. In: Boiten, E.A., Möller, B. (eds.) MPC 2002. LNCS, vol. 2386, pp. 68–93. Springer, Heidelberg (2002)

    Chapter  Google Scholar 

  8. Harrison, W.L., Kieburtz, R.B.: The logic of demand in Haskell. J. of Funct. Program. 15(6), 837–891 (2005)

    Article  MATH  MathSciNet  Google Scholar 

  9. Jung, A., Fiore, M., Moggi, E., O’Hearn, P., Riecke, J., Rosolini, G., Stark, I.: Domains and denotational semantics: history, accomplishments and open problems. Bull. of EATCS 59, 227–256 (1996)

    Google Scholar 

  10. Kahl, W., Carette, J., Ji, X.: Bimonadic semantics for basic pattern matching calculi. SQRL Report 33. Software Quality Research Laboratory, McMaster Univ. (2003), Available from: http://sqrl.mcmaster.ca/sqrl_reports.html

  11. Kahl, W.: Basic pattern matching calculi: a fresh view on matching failure. In: Kameyama, Y., Stuckey, P.J. (eds.) FLOPS 2004. LNCS, vol. 2998, pp. 276–290. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  12. Kiselyov, O., Shan, C.-c., Friedman, D.P., Sabry, A.: Backtracking, interleaving, and terminating monad transformers. In: Proc. of 10th Int. Conf. on Functional Programming, ICFP 2005, pp. 192–203. ACM Press, New York (2005)

    Google Scholar 

  13. Lüth, C., Ghani, N.: Composing monads using coproducts. In: Proc. of 7th Int. Conf. on Functional Programming, ICFP 2002, pp. 133–144. ACM Press, New York (2002)

    Google Scholar 

  14. Moggi, E.: A modular approach to denotational semantics. In: Curien, P.-L., Pitt, D.H., Pitts, A.M., Poigné, A., Rydeheard, D.E., Abramsky, S. (eds.) CTCS 1991. LNCS, vol. 530, pp. 138–139. Springer, Heidelberg (1991)

    Chapter  Google Scholar 

  15. Moggi, E.: Notions of computation and monads. Inform. and Comput. 93, 55–92 (1991)

    Article  MATH  MathSciNet  Google Scholar 

  16. Peyton Jones, S., et al.: The Revised Haskell 1998 Report. Cambridge Univ. Press, Cambridge (2003), Also available from: http://haskell.org/

    Google Scholar 

  17. Plasmeijer, R., van Eekelen, M.: Functional Programming and Parallel Graph Rewriting. Int. Computer Science Series. Addison-Wesley, Reading (1993)

    MATH  Google Scholar 

  18. Tucker, J.V., Zucker, J.I.: Abstract versus concrete computation on metric partial algebras. ACM Trans. Comput. Logic 5(4), 611–668 (2004)

    Article  MathSciNet  Google Scholar 

  19. Tullsen, M.: First class patterns. In: Pontelli, E., Santos Costa, V. (eds.) PADL 2000. LNCS, vol. 1753, pp. 1–15. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2006 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Kahl, W., Carette, J., Ji, X. (2006). Bimonadic Semantics for Basic Pattern Matching Calculi. In: Uustalu, T. (eds) Mathematics of Program Construction. MPC 2006. Lecture Notes in Computer Science, vol 4014. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11783596_16

Download citation

  • DOI: https://doi.org/10.1007/11783596_16

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-35631-8

  • Online ISBN: 978-3-540-35632-5

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics