Results 21 - 30
of
38
Generic type-preserving 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 o ers, 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 signat ..."
Abstract
-
Cited by 4 (1 self)
- Add to MetaCart
A typed model of strategic rewriting with coverage of generic traversals is developed. The corresponding calculus o ers, 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 signature-independent, that is, generic types. In the present article, we restrict ourselves to TP|the generic type of all T ype-Preserving strategies. TP is easily integrated into a standard manysorted type system for rewriting. To inhabit TP, we need to introduce a (left-biased) type-driven choice operator & ,. The operator applies its left argument (corresponding to a many-sorted 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 type-dependent to a certain extent. 1
What is a Data Type?
, 1996
"... A program derivation is said to be polytypic if some of its parameters are data types. Polytypic program derivations necessitate a general, non-inductive definition of `data type'. Here we propose such a definition: a data type is a relator that has membership. It is shown how this definition implie ..."
Abstract
-
Cited by 4 (1 self)
- Add to MetaCart
A program derivation is said to be polytypic if some of its parameters are data types. Polytypic program derivations necessitate a general, non-inductive definition of `data type'. Here we propose such a definition: a data type is a relator that has membership. It is shown how this definition implies various other properties that are shared by all data types. In particular, all data types have a unique strength, and all natural transformations between data types are strong. 1 Introduction What is a data type? It is easy to list a number of examples: pairs, lists, bags, finite sets, possibly infinite sets, function spaces . . . but such a list of examples hardly makes a definition. The obvious formalisation is a definition that builds up the class of data types inductively; such an inductive definition, however, leads to cumbersome proofs if we want to prove a property of all data types. Here we aim to give a non-inductive characterisation, defining a data type as a mathematical object...
PolyLib - a library of polytypic functions
- In Workshop on Generic Programming (WGP'98), Marstrand
, 1998
"... This paper describes the polytypic functions in PolyLib, motivates their presence in the library, and gives a rationale for their design. Thus we hope to share our experience with other researchers in the field. We will assume the reader has some familiarity with the field of polytypic programming. ..."
Abstract
-
Cited by 4 (0 self)
- Add to MetaCart
This paper describes the polytypic functions in PolyLib, motivates their presence in the library, and gives a rationale for their design. Thus we hope to share our experience with other researchers in the field. We will assume the reader has some familiarity with the field of polytypic programming. Of course, a library is an important part of a programming language. Languages like Java, Delphi, Perl and Haskell are popular partly because of their useful and extensive libraries. For a polytypic programming language it is even more important to have a clear and well-designed library: writing polytypic programs is difficult, and we do not expect many programmers to write polytypic programs. On the other hand, many programmers use polytypic programs such as parser generators, equality functions, etc. This is a first attempt to describe the library of PolyP; we expect that both the form and content of this description will change over time. One of the goals of this paper is to obtain feedback on the library design from other researchers working within the field. At the moment the library only contains the basic
Monads, Shapely Functors and Traversals
, 1999
"... This paper demonstrates the potential for combining the polytypic and monadic programming styles, by introducing a new kind of combinator, called a traversal. The natural setting for dening traversals is the class of shapely data types. This result reinforces the view that shapely data types form a ..."
Abstract
-
Cited by 3 (0 self)
- Add to MetaCart
This paper demonstrates the potential for combining the polytypic and monadic programming styles, by introducing a new kind of combinator, called a traversal. The natural setting for dening traversals is the class of shapely data types. This result reinforces the view that shapely data types form a natural domain for polytypism: they include most of the data types of interest, while to exceed them would sacrice a very smooth interaction between polytypic and monadic programming. Keywords: functional/monadic/polytypic programming, shape theory. 1 Introduction Monadic programming has proved itself extremely useful as a means of encapsulating state and other computational eects in a functional programming setting (see e.g. [12,14]). Recently, interactions between monads and data structures have been studied as a further way for structuring programs. Initially focusing on lists, the studies have been extended to the class of regular datatypes (see e.g. [4,11,1]), with the aim to embo...
An Exercise in Polytypic Program Derivation: repmin
, 1996
"... A program derivation is said to be polytypic if some of its parameters are data types. The repmin problem is to replace all elements of a tree of numbers by the minimum element, making only a single pass over the original tree. Here we present a polytypic derivation for that problem. The derivation ..."
Abstract
-
Cited by 3 (0 self)
- Add to MetaCart
A program derivation is said to be polytypic if some of its parameters are data types. The repmin problem is to replace all elements of a tree of numbers by the minimum element, making only a single pass over the original tree. Here we present a polytypic derivation for that problem. The derivation has an unusual feature: when interpreted in the category of relations, the resulting program is the well-known cyclic logic program, and when interpreted in the category of functions, it is the well-known higher-order functional solution. 1 Motivation Suppose I were to show you a derivation of a shortest path algorithm, and my whole presentation was in terms of numbers, addition and minimum. Undoubtedly some of you would get up and point out that by abstracting over the operations and recording their algebraic properties, I could have derived a whole class of algorithms instead of one particular program. Indeed, such abstraction over operations is now commonly accepted as one of the hallmar...
Polymorphism Over Nested Regular Arrays: Theory and Implementation in
, 1998
"... this paper we introduce a wider range of benchmarks, 4 ..."
Abstract
-
Cited by 2 (1 self)
- Add to MetaCart
this paper we introduce a wider range of benchmarks, 4
Poly-dimensional Array Programming
- Partial Evaluation and Automatic Program Generation. International Series in Computer Science
, 1998
"... . FISh is the first language to support a poly-dimensional, data polymorphic type constructor for regular arrays. Now a fully-typed program may take a vector, matrix or higher-dimensional regular array as argument. Regularity is defined using shape theory, which was also used to guide the language d ..."
Abstract
-
Cited by 2 (2 self)
- Add to MetaCart
. FISh is the first language to support a poly-dimensional, data polymorphic type constructor for regular arrays. Now a fully-typed program may take a vector, matrix or higher-dimensional regular array as argument. Regularity is defined using shape theory, which was also used to guide the language design, e.g. by justifying the exclusion of arrays of functions. Regularity is enforced by static shape analysis which determines the shape of all arrays during compilation. As well as supporting poly-dimensional programming, it detects all shape errors, a common source of array bound errors. Further, shape analysis supports an aggressive compilation strategy, that compiles FISh programs into simple, efficient C programs. Thus FISh combines the expressive power of higher-order polymorphic programming with the speed of simple imperative programming. Version 1 is available over the internet. Key words: poly-dimensional arrays, FISh, shape analysis 1 Introduction FISh is the first language to s...
Towards polytypic parallel programming
, 1998
"... Data parallelism is currently one of the most successful models for programming massively parallel computers. The central idea is to evaluate a uniform collection of data in parallel by simultaneously manipulating each data element in the collection. Despite many of its promising features, the curre ..."
Abstract
-
Cited by 2 (2 self)
- Add to MetaCart
Data parallelism is currently one of the most successful models for programming massively parallel computers. The central idea is to evaluate a uniform collection of data in parallel by simultaneously manipulating each data element in the collection. Despite many of its promising features, the current approach suffers from two problems. First, the main parallel data structures that most data parallel languages currently support are restricted to simple collection data types like lists, arrays or similar structures. But other useful data structures like trees have not been well addressed. Second, parallel programming relies on a set of parallel primitives that capture parallel skeletons of interest. However, these primitives are not well structured, and efficient parallel programming with these primitives is difficult. In this paper, we propose a polytypic framework for developing efficient parallel programs on most data structures. We showhow a set of polytypic parallel primitives can be formally defined for manipulating most data structures, how these primitives can be successfully structured into a uniform recursive definition, and how an efficient combination of primitives can be derived from a naive specification program. Our framework should be significant not only in development of new parallel algorithms, but also in construction of parallelizing compilers.
Functor Pulling
- In Workshop on Generic Programming (WGP’98
, 1998
"... This paper is concerned with the construction of basic building blocks for polytypic programming. A polytypic program is a program that is generic in a type constructor, say F ; by specializing it for F:=List , a program for lists is obtained, while for F:=Tree we get a program for trees, and so on. ..."
Abstract
-
Cited by 2 (0 self)
- Add to MetaCart
This paper is concerned with the construction of basic building blocks for polytypic programming. A polytypic program is a program that is generic in a type constructor, say F ; by specializing it for F:=List , a program for lists is obtained, while for F:=Tree we get a program for trees, and so on. Well-known examples of such polytypic building blocks are the initial algebra for F (assuming F is such that an initial algebra exists): in F : F /FF and the catamorphism combinator: ([f ]) F : a /F ( f : a /Fa For more details, see [7] or [1]. A previous paper [8] defined a crush combinator hh\Phiii F : a /F ha; a; : : : ; ai ( \Phi : a / a \Theta a for all "regular" F , giving a generic way to reduce data structures with a binary operation. In this paper we define a generalization of crush, and present some examples. Further polytypic basic building blocks, as well as several advanced applications, can be found in [5, 6, 4] Part of this work was performed while visiting Kestrel Institute, Palo Alto. 2 Preliminaries Constant functions Given x 2 A, the mapping (z 7! x ) always returning x is denoted as x . It can be polymorphically typed as x : A/ a with a type variable a. We have x f = x for any f
Comparing Approaches to Polytypic Programming
, 1999
"... This document can be represented by the datatype Html4 as follows: my_html :: Html4 ParType my_html = List [ Heading (HeadingPar 1) (Text (TextPar "My Home Page")) , HRule , Break , Heading (HeadingPar 2) (Text (TextPar "Links to my friends:")) , List [ Link (UrlPar "http://...martijn...") (Text (Te ..."
Abstract
-
Cited by 1 (0 self)
- Add to MetaCart
This document can be represented by the datatype Html4 as follows: my_html :: Html4 ParType my_html = List [ Heading (HeadingPar 1) (Text (TextPar "My Home Page")) , HRule , Break , Heading (HeadingPar 2) (Text (TextPar "Links to my friends:")) , List [ Link (UrlPar "http://...martijn...") (Text (TextPar "Martijn")) , Link (UrlPar "http://...michiel...") (Text (TextPar "Jantje")) ] ] To compress my_html using the strategy described above, its shape and data must be separated. The data can be obtained by attening, it is a list of values of type ParType: [ HeadingPar 1 , TextPar "My Home Page" , HeadingPar 2 , TextPar "Links to my friends:" , UrlPar "http://...martijn..." , TextPar "Martijn" , UrlPar "http://..jantje..." , TextPar "Jantje" ] The shape of my_html is obtained by replacing each datum by (), i.e. by leaving out the data. Since all data is declared as a parameter, the shape consists of just constructors. The rst step in shape compression is attening the shape to a list of constructors. Here is a representation of the attened shape of my_html: [ List, Cons, Heading, Text , Cons, HRule , Cons, Break , Cons, Heading, Text , Cons, List, Cons, Link, Text , Cons, Link, Text , Nil , Nil ] The list is formatted such that the represented structure is still visible. Since all datatypes in Haskell are sum-of-product datatypes, all datatypes in PolyP are sum-of-product datatypes too. The constructors of any datatype in PolyP can therefore be coded as natural numbers indicating which injection into the sum each constructor represents. These numbers are easily retrieved by inspecting the data declaration of a given datatype. We call such a number the

