First Class Patterns (2000) [12 citations — 1 self]
Abstract:
. Pattern matching is a great convenience in programming. However, pattern matching has its problems: it conicts with data abstraction; it is complex (at least in Haskell, which has pattern guards, irrefutable patterns, n+k patterns, as patterns, etc.); it is a source of runtime errors; and lastly, one cannot abstract over patterns as they are not a rst class language construct. This paper proposes a simplication of pattern matching that makes patterns rst class. The key idea is to treat patterns as functions of type a!Maybe bi.e., a!(Nothing|Just b); thus, patterns and pattern combinators can be written as functions in the language. 1 Introduction A hotly debated issue in the language Haskell [HJW92] has been patterns. What are their semantics? Do we want n+1 patterns? Do we need @-patterns? When do we match lazily and when do we match strictly? Do we need to extend patterns with pattern guards? And etc. In this paper I will propose, not another extension, but a simplicat...
Citations
| 104 | Views: A way for pattern matching to cohabit with data abstraction – WADLER - 1987 |
| 87 | Generalising monads to arrows – Hughes - 2000 |
| 77 | to replace failure by a list of successes – Wadler - 1985 |
| 71 | Report on the programming language Haskell – Hudak, Wadler - 1991 |
| 50 | Monadic Parser Combinators – Hutton, Meijer - 1996 |
| 31 | Efficient Compilation of Pattern-Matching – Wadler - 1987 |
| 25 | Pattern Matching with Abstract Data Types – Burton, Cameron - 1993 |
| 13 | Statically checkable pattern abstractions – FĂ„HNDRICH, J - 1997 |
| 7 | Abstract value constructors: Symbolic constants for Standard ML – Aitken, Reppy - 1992 |
| 1 | A new look at pattern matching in abstract data types – Pedro, Pea, et al. - 1996 |

