Results 1 -
4 of
4
Type-Indexed Data Types
- SCIENCE OF COMPUTER PROGRAMMING
, 2004
"... A polytypic function is a function that can be instantiated on many data types to obtain data type specific functionality. Examples of polytypic functions are the functions that can be derived in Haskell, such as show , read , and ` '. More advanced examples are functions for digital searching, patt ..."
Abstract
-
Cited by 53 (19 self)
- Add to MetaCart
A polytypic function is a function that can be instantiated on many data types to obtain data type specific functionality. Examples of polytypic functions are the functions that can be derived in Haskell, such as show , read , and ` '. More advanced examples are functions for digital searching, pattern matching, unification, rewriting, and structure editing. For each of these problems, we not only have to define polytypic functionality, but also a type-indexed data type: a data type that is constructed in a generic way from an argument data type. For example, in the case of digital searching we have to define a search tree type by induction on the structure of the type of search keys. This paper shows how to define type-indexed data types, discusses several examples of type-indexed data types, and shows how to specialize type-indexed data types. The approach has been implemented in Generic Haskell, a generic programming extension of the functional language Haskell.
A framework for polytypic programming on terms, with an application to rewriting
- Workshop on Generic Programming
, 2000
"... Given any value of a datatype (an algebra of terms), and rules to rewrite values of that datatype, we want a function that rewrites the value to normal form if the value is normalizable. This paper develops a polytypic rewriting function that uses the parallel innermost rewriting strategy. It improv ..."
Abstract
-
Cited by 13 (7 self)
- Add to MetaCart
Given any value of a datatype (an algebra of terms), and rules to rewrite values of that datatype, we want a function that rewrites the value to normal form if the value is normalizable. This paper develops a polytypic rewriting function that uses the parallel innermost rewriting strategy. It improves upon our earlier work on polytypic rewriting in two fundamental ways. Firstly, the rewriting function uses a term interface that hides the polytypic part from the rest of the program. The term interface is a framework for polytypic programming on terms. This implies that the rewriting function is independent of the particular implementation of polytypism. We give several functions and laws on terms, which simplify calculating with programs. Secondly, the rewriting function is developed together with a correctness proof. We just present the result of the correctness proof, the proof itself is published elsewhere.
Polytypic Programming With Ease
, 1999
"... A functional polytypic program is one that is parameterised by datatype. Since polytypic functions are defined by induction on types rather than by induction on values they typically operate on a higher level of abstraction than their monotypic counterparts. However, polytypic programming is not nec ..."
Abstract
-
Cited by 13 (5 self)
- Add to MetaCart
A functional polytypic program is one that is parameterised by datatype. Since polytypic functions are defined by induction on types rather than by induction on values they typically operate on a higher level of abstraction than their monotypic counterparts. However, polytypic programming is not necessarily more complicated than conventional programming. We show that a polytypic function is uniquely defined by its action on constant functors, projection functors, sums, and products. This information is sufficient to specialize a polytypic function to arbitrary polymorphic datatypes, including mutually recursive datatypes and nested datatypes. The key idea is to use infinite trees as index sets for polytypic functions and to interpret datatypes as algebraic trees. This approach appears both to be simpler, more general, and more efficient than previous ones which are based on the initial algebra semantics of datatypes. Polytypic functions enjoy polytypic properties. We show that well-kno...
A Framework for Polytypic Programming on Terms, With an Application to Rewriting
"... Given any value of a datatype (an algebra of terms), and rules to rewrite values of that ..."
Abstract
- Add to MetaCart
Given any value of a datatype (an algebra of terms), and rules to rewrite values of that

