Bimonadic semantics for basic pattern matching calculi

  • Authors:
  • Wolfram Kahl;Jacques Carette;Xiaoheng Ji

  • Affiliations:
  • Department of Computing and Software, McMaster University, Hamilton, Ontario, Canada;Department of Computing and Software, McMaster University, Hamilton, Ontario, Canada;Department of Computing and Software, McMaster University, Hamilton, Ontario, Canada

  • Venue:
  • MPC'06 Proceedings of the 8th international conference on Mathematics of Program Construction
  • Year:
  • 2006

Quantified Score

Hi-index 0.00

Visualization

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.