Results 1  10
of
13
Typed Combinators for Generic Traversal
 Proc. of PADL 2002
, 2002
"... Lacking support for generic traversal, functional programming languages suffer from a scalability problem when applied to largescale program transformation problems. As a solution, we introduce functional strategies: typeful generic functions that not only can be applied to terms of any type, bu ..."
Abstract

Cited by 70 (22 self)
 Add to MetaCart
Lacking support for generic traversal, functional programming languages suffer from a scalability problem when applied to largescale program transformation problems. As a solution, we introduce functional strategies: typeful generic functions that not only can be applied to terms of any type, but which also allow generic traversal into subterms.
Typed generic traversal with term rewriting strategies
, 2002
"... A typed model of strategic term rewriting is developed. The key innovation is that generic. The calculus traversal is covered. To this end, we define a typed rewriting calculus S ′ γ employs a manysorted type system extended by designated generic strategy types γ. We consider two generic strategy t ..."
Abstract

Cited by 36 (10 self)
 Add to MetaCart
A typed model of strategic term rewriting is developed. The key innovation is that generic. The calculus traversal is covered. To this end, we define a typed rewriting calculus S ′ γ employs a manysorted type system extended by designated generic strategy types γ. We consider two generic strategy types, namely the types of typepreserving and typeunifying strategies. S ′ γ offers traversal combinators to construct traversals or schemes thereof from manysorted and generic strategies. The traversal combinators model different forms of onestep traversal, that is, they process the immediate subterms of a given term without anticipating any scheme of recursion into terms. To inhabit generic types, we need to add a fundamental combinator to lift a manysorted strategy s to a generic type γ. This step is called strategy extension. The semantics of the corresponding combinator states that s is only applied if the type of the term at hand fits, otherwise the extended strategy fails. This approach dictates that the semantics of strategy application must be typedependent to a certain extent. Typed strategic term rewriting with coverage of generic term traversal is a simple but expressive model of generic programming. It has applications in program
The sketch of a polymorphic symphony
, 2002
"... Functional strategies were previously defined as firstclass generic functions which can traverse into terms while mixing uniform and typespecific behaviour. The firstclass status is witnessed by a combinator style of generic programming. This symphony reconstructs functional strategies as an amal ..."
Abstract

Cited by 17 (9 self)
 Add to MetaCart
Functional strategies were previously defined as firstclass generic functions which can traverse into terms while mixing uniform and typespecific behaviour. The firstclass status is witnessed by a combinator style of generic programming. This symphony reconstructs functional strategies as an amalgamation of certain bits of parametric polymorphism, type case, polytypism, and overloading. We illustrate the expressiveness and conciseness of this reconstruction by providing highly parameterized definitions of traversal schemes. The resulting style of generic programming is extremely lightweight and easy to use because it only involves two special combinators not yet present in standard functional programming. The reconstruction is geared towards Haskell, and it is supported by a generative tool YAGH—Yet Another Generic Haskell.
Twolevel types and parameterized modules
 Journal of Functional Programming
, 2003
"... In this paper, we describe two techniques for the efficient, modularized implementation of a large class of algorithms. We illustrate these techniques using several examples, including efficient generic unification algorithms that use reference cells to encode substitutions, and highly modular langu ..."
Abstract

Cited by 13 (0 self)
 Add to MetaCart
(Show Context)
In this paper, we describe two techniques for the efficient, modularized implementation of a large class of algorithms. We illustrate these techniques using several examples, including efficient generic unification algorithms that use reference cells to encode substitutions, and highly modular language implementations. We chose these examples to illustrate the following important techniques that we believe many functional programmers would find useful. First, defining recursive data types by splitting them into two levels: a structure defining level, and a recursive knottying level. Second, the use of rank2 polymorphism inside Haskell’s record types to implement a kind of typeparameterized modules. Finally, we explore techniques that allow us to combine already existing recursive Haskell datatypes with the highly modular style of programming proposed here. 1
Firstclass Rules and Generic Traversal
, 2001
"... In this paper we present a functional language supporting firstclass rules and generic traversal. This is achieved by generalizing the pattern matching constructs of standard functional languages. The case construct that ties rules together and prevents their reuse, is replaced by separate, firs ..."
Abstract

Cited by 11 (2 self)
 Add to MetaCart
(Show Context)
In this paper we present a functional language supporting firstclass rules and generic traversal. This is achieved by generalizing the pattern matching constructs of standard functional languages. The case construct that ties rules together and prevents their reuse, is replaced by separate, firstclass, pattern matching rules and a choice combinator that deals with pattern match failure. Generic traversal is achieved through application pattern matching in which a constructor application is generically divided into a prefix and a su#x, thus giving generic access to the subterms of a constructor term. Many highly generic term traversals can be defined in a typesafe way using this feature.
First Class Rules and Generic Traversals for Program Transformation Languages
 Utrecht University
, 2001
"... The subject of this thesis is the construction of programming languages suitable for the implementation of program transformation systems. First class rules and generic traversals are especially useful in such languages. Stratego, a language specifically intended for program transformations, support ..."
Abstract

Cited by 7 (2 self)
 Add to MetaCart
The subject of this thesis is the construction of programming languages suitable for the implementation of program transformation systems. First class rules and generic traversals are especially useful in such languages. Stratego, a language specifically intended for program transformations, supports these features, but is untyped and impure. In this thesis we develop a pure nonstrict functional language called RhoStratego, incorporating features from Stratego. First class rules are obtained through the equivalent of Stratego's leftbiased choice operator. This approach is not only useful to strategic programming, but is also more powerful than existing proposals to extend pattern matching, such as views and pattern guards. Stratego's generic traversal primitives are implemented through a more fundamental mechanism, the application pattern match, whereby constructed values can be deconstructed in a generic and typeable fashion. We present the syntax and semantics of the language, as well as the semantics of a strict variant. Furthermore, we have developed a type system for RhoStratego, which consists of the HindleyMilner type system extended with rank2 polymorphism and typing rules to support generic traversals. The type system is powerful enough to allow, and ensure the safety of, type unifying and type preserving generic transformations. We have implemented a type checker that infers all types, except rank2 types for which annotations must be given. We also discuss the results of the implementation of a compiler for RhoStratego, and in particular how generic traversals and the choice operator can be implemented. Contents 1
Generic typepreserving traversal strategies
 PROC. INTERNATIONAL WORKSHOP ON REDUCTION STRATEGIES IN REWRITING AND PROGRAMMING (WRS 2001), VOLUME SPUPV 2359
, 2001
"... A typed model of strategic rewriting with coverage of generic traversals is developed. The corresponding calculus offers, for example, a strategy operator 2 (), which applies the argument strategy to all immediate subterms. To provide a typeful model for generic strategies, one has to identify signa ..."
Abstract

Cited by 4 (1 self)
 Add to MetaCart
(Show Context)
A typed model of strategic rewriting with coverage of generic traversals is developed. The corresponding calculus offers, for example, a strategy operator 2 (), which applies the argument strategy to all immediate subterms. To provide a typeful model for generic strategies, one has to identify signatureindependent, that is, generic types. In the present article, we restrict ourselves to TP  the generic type of all TypePreserving strategies. TP is easily integrated into a standard manysorted type system for rewriting. To inhabit TP, we need to introduce a (leftbiased) typedriven choice operator & ,. The operator applies its left argument (corresponding to a manysorted strategy) if the type of the given term ts, and the operator resorts to the right argument (corresponding to a generic default) otherwise. This approach dictates that the semantics of strategy application must be typedependent to a certain extent.
Strategy Application, Observability, and the Choice Combinator. Sandia
"... In many strategic systems, the choice combinator provides a powerful mechanism for controlling the application of rules and strategies to terms. The ability of the choice combinator to exercise control over rewriting is based on the premise that the success and failure of strategy application can be ..."
Abstract

Cited by 1 (1 self)
 Add to MetaCart
In many strategic systems, the choice combinator provides a powerful mechanism for controlling the application of rules and strategies to terms. The ability of the choice combinator to exercise control over rewriting is based on the premise that the success and failure of strategy application can be observed. In this paper we present a higherorder strategic framework with the ability to dynamically construct strategies containing the choice combinator. To this framework, a combinator called hide is introduced that prevents the successful application of a strategy from being observed by the choice combinator. We then explore the impact of this new combinator on a realworld problem involving a restricted implementation of the Java Virtual Machine.