| Mark Tullsen. First class patterns. In Enrico Pontelli and Vtor Santos Costa, editors, PADL 2000, volume 1753 of LNCS, pages 1--15. Springer, 2000. |
....tools such as parsers, pretty printers, and Stratego specifications. 7 Related Work 7.1 Extensions to Pattern Matching In this section we take a closer look at the choice operator, and its impact on programming in RhoStratego. It is well known that conventional pattern matching is not perfect [25, 14]. It turns out that the choice operator eliminates the need for many of the proposals to extend pattern matching in functional languages such as Haskell, including views, pattern guards, transformational 22 patterns, and first class patterns. Furthermore, it makes case expressions and sugar such ....
....an expression which is applied to the argument. The expression should return a tuple of arity n. The pattern arguments are then matched against the elements of the tuple. Therefore, f is desugared into: f = y ( x, xs x) snoc y) y ( 0) lin y) First class Patterns Tullsen [25] treats patterns as functions of type # Maybe #, and combinators are provided to combine basic patterns into complex ones. Although conceptually elegant, this approach su#ers from the fact that the syntax is not very attractive. Furthermore, every function that can fail must have the Maybe ....
M. Tullsen. First class patterns. In 2nd International Workshop on Practial Aspects of Declarative Languages, volume 1753 of LNCS, pages 1--15, 2000. 7.1, 7.1
....reduction rules. The formal presentation of this strategy is given in appendix B as well. 4.4 Choice and pattern matching In this section we take a closer look at the choice operator, and its impact on programming in RhoStratego. It is well known that regular pattern matching is not 29 perfect [Tul00, EP00] It turns out that the choice operator eliminates the need for many of the proposals to extend pattern matching in functional languages such as Haskell, including views, pattern guards, and transformational patterns. Furthermore, it makes existing sugar, such as Haskell s equational ....
....an expression which is applied to the argument. The expression should return a tuple of arity n. The pattern arguments are then matched against the elements of the tuple. Therefore, f is desugared into: f = y ( x, x) snoc y) y ( 0) lin y) First class patterns Tullsen [Tul00] treats patterns as functions of type # # Maybe #, and combinators are provided to combine basic patterns into complex ones. Although conceptually elegant, this approach su#ers from the fact that the syntax is not very attractive. Furthermore, every function that can fail must have the Maybe ....
Mark Tullsen. First class patterns. In 2nd International Workshop on Practial Aspects of Declarative Languages, volume 1753 of LNCS, pages 1--15, 2000.
....of tools such as parsers, pretty printers, and Stratego speci cations. 7 Related Work 7.1 Extensions to Pattern Matching In this section we take a closer look at the choice operator, and its impact on programming in RhoStratego. It is well known that conventional pattern matching is not perfect [25, 14]. It turns out that the choice operator eliminates the need for many of the proposals to extend pattern matching in functional languages such as Haskell, including views, pattern guards, transformational patterns, and rstclass patterns. Furthermore, it makes case expressions and sugar such as ....
....es an expression which is applied to the argument. The expression should return a tuple of arity n. The pattern arguments are then matched against the elements of the tuple. Therefore, f is desugared into: f = y ( x, xs x) snoc y) y ( 0) lin y) First class Patterns Tullsen [25] treats patterns as functions of type Maybe , and combinators are provided to combine basic patterns into complex ones. Although conceptually elegant, this approach su ers from the fact that the syntax is not very attractive. Furthermore, every function that can fail must have the Maybe type; ....
M. Tullsen. First class patterns. In 2nd International Workshop on Practial Aspects of Declarative Languages, volume 1753 of LNCS, pages 1-15, 2000.
.... 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 ....
....In contrast, pattern abstractions [7] do allow a very limited form of computation; the aim is to generalise pattern matching only as far as static analyses, such as checking overlapping patterns or exhaustiveness, are still decidable. A di erent route to pattern matching is taken by Tullsen [17], who considers patterns as functions of type a Maybe b. This allows the treatment of patterns as rst class objects; in particular, it is possible to write pattern combinators. Although the semantics of patterns can be simpli ed considerably by that approach, the use of patterns in the ....
M. Tullsen. First Class Patterns. In 2nd Int. Workshop on Practical Aspects of Declarative Languages, LNCS 1753, pages 1-15, 2000.
....with recursive data types and a x point operator) unless a primitive such as seqTupleMaybe is added: seqTupleMaybe : h i a :i Maybe b :i i a Maybe( b) However, once this primitive is added, n tuple patterns can be de ned. It is a trivial extension of the transformation given in [Tul00]. Section 5.1 returns to this problem of functions that must be primitives. 4.2 More General Laws The parametricity theorem for an uncurried zip3 map(cross3hf,g,hi) zip3 = zip3 cross3hmap f,map g,map hi where cross3 hf,g,hi hx,y,zi = hf x, g y, h zi can be generalized in the zip calculus to ....
Mark Tullsen. First class patterns. In E. Pontelli and V. Santos Costa, editors, Second International Workshop on Practical Aspects of Declarative Languages (PADL'00), volume 1753 of Lecture Notes in Computer Science. Springer-Verlag, 2000.
....a primitive such as seqTupleMaybe is added: seqTupleMaybe : h i a:i Maybe b:ii a Maybe( b) However, once this primitive is added, one can de ne n tuple patterns in terms of this primitive. Using seqTupleMaybe we can translate patterns out of the language similarly to that done in [16]. Section 5.1 returns to this problem of functions that must be primitives. 4.2 More General Laws The parametricity theorem for an uncurried zip3 map(cross3 hf,g,hi) zip3 = zip3 cross3 hmap f,map g,map hi where cross3 hf,g,hi hx,y,zi = hf x, g y, h zi can be generalized in the zip calculus ....
Mark Tullsen. First class patterns. In E. Pontelli and V. Santos Costa, editors, Second International Workshop on Practical Aspects of Declarative Languages (PADL'00), volume 1753 of Lecture Notes in Computer Science, pages 115. Springer-Verlag, January 2000.
No context found.
Mark Tullsen. First class patterns. In Enrico Pontelli and Vtor Santos Costa, editors, PADL 2000, volume 1753 of LNCS, pages 1--15. Springer, 2000.
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