| M. Mohnen. Context Patterns in Haskell. In 8th Int. Workshop on Implementation of Functional Languages, LNCS 1268, pages 307-319, 1996. |
.... for extending the capabilities of patterns and pattern matching; in particular, the problems with pattern matching on abstract data types have stimulated a lot of research [19, 16, 3, 12, 4, 6, 11] Other aspects have also been subject to extensions and generalisations of pattern matching [8, 1, 9, 7, 17]. All these approaches di er in what they can be used for, in their syntax, and in their properties, which makes it almost impossible to use two or more di erent approaches at the same time. Moreover, among all these di erent approaches there is no clear winner, although so called views seem to ....
....patterns because the argument and result type must be the same. Just as views and laws and the other approaches mentioned so far were motivated by combining pattern matching and ADTs, there are some other, more limited, approaches that are also driven by speci c applications: context patterns [9] give direct access to arbitrary deeply nested sub parts of terms; they are very similar to other tree transforming languages (for example, 8, 15] In particular, they only work for algebraic, free data types, and computations on matched values are not possible. The abstract value constructors ....
M. Mohnen. Context Patterns in Haskell. In 8th Int. Workshop on Implementation of Functional Languages, LNCS 1268, pages 307-319, 1996.
.... for extending the capabilities of patterns and pattern matching; in particular, the problems with pattern matching on abstract data types have stimulated a lot of research [17, 15, 3, 11, 4, 5, 10] Other aspects have also been subject to extensions and generalizations of pattern matching [8, 1, 9, 7]. All these approaches di er in what they can be used for, in their syntax, and in their properties, which makes it almost impossible to use two or more di erent approaches at the same time. Moreover, among all these di erent approaches there is no clear winner, although views seem to be the most ....
....patterns because the argument and result type must be the same. Just as views and laws and the other approaches mentioned so far were motivated by combining pattern matching and ADTs, there are some other, more limited, approaches that are also driven by speci c applications: context patterns [9] give direct access to arbitrary deeply nested sub parts of terms; they are very similar to other tree transforming languages (for example, 8, 14] In particular, they only work for algebraic, free data types, and computations on matched values are not possible. The abstract value constructors ....
M. Mohnen. Context Patterns in Haskell. In 8th Int. Workshop on Implementation of Functional Languages, LNCS 1268, pages 307-319, 1996.
....when matching subtrees. Programming functions explicitly over the XML datastructure, without the abstraction of combinators, Haskell pattern matching provides bindings for subtrees. But only at a fixed (small) depth from the root, beneath an explicitly stated pattern of constructors. Mohnen [9] defines an extension of the pattern language for deep matching: variables in a pattern can be bound to subterms at arbitrary depth inside the original term. The result of the match includes a 12 http: www.cs.tu bs.de softech people lindig tony.html 13 http: www.informatik.uni trier.de ....
Markus Mohnen. Context patterns in Haskell. In Workshop on Implementation of Functional Languages, pages 41--57. Springer LNCS Vol 1268, September 1996.
....reasoning because constructors of non free data types can be used to construct values. This is overcome by the proposal of [BC93] where these constructors may be only used within patterns. We expect the same for active patterns since they too can only be used in patterns. Context Patterns [Moh96] are intended to give direct access to arbitrary deeply nested sub parts of terms, but they only work for free data types. The abstract value constructors of [AR92] provide a kind of macro facility to denote terms in a more convenient (and abstract) way. However, no computations in the sense of ....
M. Mohnen. Context Patterns in Haskell. In 8th Int. Workshop on Implementation of Functional Languages, LNCS (this volume), 1996.
....transform it by replacing the pattern. In this paper we introduce a new construct called extended context, which allows the de nition of transformational functions without superAEuous repetition of the recursive search. 1 Introduction This paper is the successor to iContext Patterns in Haskellj [Moh97]. That work described a new nonlocal kind of pattern which allows matching of subterms without xed distance from the root of the value. The underlying observation is that standard patterns allow only the matching of a xed region near the root of the structure. Consequently, the resulting ....
....only without revisiting the parts before the last match. Furthermore, we give a formal de nition of the static semantics of context patterns. This paper is organised as follows. In Section 2 we introduce context patterns by example program and discuss the necessary modi cation to the approach in [Moh97]. Section 3 de nes syntax and static semantics of context patterns. The implementation is described by a translation of context patterns to standard Haskell which is presented in Section 4. Some of the previous work in pattern matching and topics related to our approach is reviewed in Section 5. ....
[Article contains additional citation context not shown here]
M. Mohnen. Context Patterns in Haskell. In Kluge et.al. [Klu97], pages 4158.
....applications of context patterns are functions which search a data structure and possibly transform it, especially functions which operate on programs as data objects. In this paper we describe our approach on extending the Glasgow Haskell Compiler (ghc) with context patterns. 1 Introduction In [Moh97] we introduced context patterns, a new nonlocal form of patterns, which allow the matching of subterms without xed distance from the root of the whole term. The main motivation for context patterns is the need for an adequate method for describing transformations, e.g. in optimising compilers ....
....of the application (c [ on the right hand side yields the initial part [a 1 ; an Gamma1 ] if the list. In order to demonstrate how to program transformations using context patterns, we give one more example program. More examples and a detailed discussion on related work can be found in [Moh97]. The Glasgow Haskell Compiler ghc compiles Haskell programs by translation into an intermediate language Core [PS94, Pey96] The part which performs this translation is called the desugarer, because it removes the syntactic sugar like patternmatching, list comprehensions, etc. One small subtask ....
[Article contains additional citation context not shown here]
M. Mohnen. Context Patterns in Haskell. In W. Kluge et.al., editor, Selected Papers of the 8th International Workshop on Implementation of Functional Languages (IFL), number 1268 in Lecture Notes in Computer Science, pages 4158. SpringerVerlag, 1997.
Online articles have much greater impact More about CiteSeer.IST Add search form to your site Submit documents Feedback
CiteSeer.IST - Copyright Penn State and NEC