Results 1 - 10
of
13
Polytypic Values Possess Polykinded Types
, 2000
"... A polytypic value is one that is defined by induction on the structure of types. In Haskell the type structure is described by the so-called kind system, which distinguishes between manifest types like the type of integers and functions on types like the list type constructor. Previous approaches to ..."
Abstract
-
Cited by 102 (20 self)
- Add to MetaCart
A polytypic value is one that is defined by induction on the structure of types. In Haskell the type structure is described by the so-called kind system, which distinguishes between manifest types like the type of integers and functions on types like the list type constructor. Previous approaches to polytypic programming were restricted in that they only allowed to parameterize values by types of one fixed kind. In this paper we show how to define values that are indexed by types of arbitrary kinds. It appears that these polytypic values possess types that are indexed by kinds. We present several examples that demonstrate that the additional exibility is useful in practice. One paradigmatic example is the mapping function, which describes the functorial action on arrows. A single polytypic definition yields mapping functions for datatypes of arbitrary kinds including first- and higher-order functors. Polytypic values enjoy polytypic properties. Using kind-indexed logical relations we prove...
Generic programming: An introduction
- 3rd International Summer School on Advanced Functional Programming
, 1999
"... ..."
Generic Downwards Accumulations
- Science of Computer Programming
, 2000
"... . A downwards accumulation is a higher-order operation that distributes information downwards through a data structure, from the root towards the leaves. The concept was originally introduced in an ad hoc way for just a couple of kinds of tree. We generalize the concept to an arbitrary regular d ..."
Abstract
-
Cited by 17 (2 self)
- Add to MetaCart
. A downwards accumulation is a higher-order operation that distributes information downwards through a data structure, from the root towards the leaves. The concept was originally introduced in an ad hoc way for just a couple of kinds of tree. We generalize the concept to an arbitrary regular datatype; the resulting denition is co-inductive. 1 Introduction The notion of scans or accumulations on lists is well known, and has proved very fruitful for expressing and calculating with programs involving lists [4]. Gibbons [7, 8] generalizes the notion of accumulation to various kinds of tree; that generalization too has proved fruitful, underlying the derivations of a number of tree algorithms, such as the parallel prex algorithm for prex sums [15, 8], Reingold and Tilford's algorithm for drawing trees tidily [21, 9], and algorithms for query evaluation in structured text [16, 23]. There are two varieties of accumulation on lists: leftwards and rightwards. Leftwards accumulation ...
Structural Polymorphism
- Informal Proceedings Workshop on Generic Programming, WGP'98, Marstrand
, 1998
"... This paper describes structural polymorphism, a new form of type polymorphism appropriate to functional languages featuring user-defined algebraic data types (e.g., Standard ML, Haskell and Miranda 1 ). The approach extends the familiar notion of parametric polymorphism by allowing the definition of ..."
Abstract
-
Cited by 6 (0 self)
- Add to MetaCart
This paper describes structural polymorphism, a new form of type polymorphism appropriate to functional languages featuring user-defined algebraic data types (e.g., Standard ML, Haskell and Miranda 1 ). The approach extends the familiar notion of parametric polymorphism by allowing the definition of functions which are generic with respect to data structures as well as to individual types. For example, structural polymorphism accommodates generalizations of the usual length and map functions which may be applied not only to lists, but also to trees, binary trees or similar algebraic structures. Under traditional polymorphic type systems, these functions may be defined for arbitrary component types, but must be (laboriously) re-defined for every distinct data structure. In this sense, our approach also extends the spirit of parametric polymorphism, in that it provides the programmer relief from the burden of unnecessary repetitive effort. The mechanism we will use to realize this form of polymorphism is inspired by a feature familiar to functional programmers, namely the pattern abstraction. Pattern abstractions generalize the usual lambda abstraction (x.e) in that they are comprised of multiple pattern/expression clauses, rather than just a single bound-variable/expression pair. By analogy with pattern abstractions, we generalize polymorphic type abstractions (Òå.e) to type-pattern abstractions, which are comprised of multiple type-pattern/expression pairs. The types given to type-pattern abstractions are universally quantified, just as for traditional type abstractions, but the universal quantifiers are now justified by a recursive analysis of the forms of all possible type instantiations, rather than by parametric independence with respect to a type variable. (x:+.e) ...
Final Dialgebras: From Categories to Allegories
- Workshop on Fixed Points in Computer Science
, 1999
"... The study of inductive and coinductive types (like finite lists and streams, respectively) is usually conducted within the framework of category theory, which to all intents and purposes is a theory of sets and functions between sets. Allegory theory, an extension of category theory due to Freyd, is ..."
Abstract
-
Cited by 6 (3 self)
- Add to MetaCart
The study of inductive and coinductive types (like finite lists and streams, respectively) is usually conducted within the framework of category theory, which to all intents and purposes is a theory of sets and functions between sets. Allegory theory, an extension of category theory due to Freyd, is better suited to modelling relations between sets as opposed to functions between sets. The question thus arises of how to extend the standard categorical results on the existence of final objects in categories (for example, coalgebras and products) to their existence in allegories. The motivation is to streamline current work on generic programming, in which the use of a relational theory rather than a functional theory has proved to be desirable. In this paper, we define the notion of a relational final dialgebra and prove, for an important class of dialgebras, that a relational final dialgebra exists in an allegory if and only if a final dialgebra exists in the underlying category of map...
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...
Generic Operations on Nested Datatypes
, 2001
"... Nested datatypes are a generalisation of the class of regular datatypes, which includes familiar datatypes like trees and lists. They typically represent constraints on the values of regular datatypes and are therefore used to minimise the scope for programmer error. ..."
Abstract
-
Cited by 3 (0 self)
- Add to MetaCart
Nested datatypes are a generalisation of the class of regular datatypes, which includes familiar datatypes like trees and lists. They typically represent constraints on the values of regular datatypes and are therefore used to minimise the scope for programmer error.
Parametric Datatype-Genericity
"... Datatype-generic programs are programs that are parametrized by a datatype or type functor: whereas polymorphic programs abstract from the ‘integers ’ in ‘lists of integers’, datatype-generic programs abstract from the ‘lists of’. There are two main styles of datatype-generic programming: the Algebr ..."
Abstract
-
Cited by 3 (1 self)
- Add to MetaCart
Datatype-generic programs are programs that are parametrized by a datatype or type functor: whereas polymorphic programs abstract from the ‘integers ’ in ‘lists of integers’, datatype-generic programs abstract from the ‘lists of’. There are two main styles of datatype-generic programming: the Algebra of Programming approach, characterized by structured recursion operators arising from initial algebras and final coalgebras, and the Generic Haskell approach, characterized by case analysis over the structure of a datatype. We show that the former enjoys a kind of higherorder naturality, relating the behaviours of generic functions at different types; in contrast, the latter is ad hoc, with no coherence required or provided between the various clauses of a definition. Moreover, the naturality properties arise ‘for free’, simply from the parametrized types of the generic functions: we present a higherorder parametricity theorem for datatype-generic operators. Categories and Subject Descriptors D.3.3 [Programming languages]: Language constructs and features—Polymorphism, patterns, control structures, recursion; F.3.3 [Logics and meanings of programs]: Studies of program constructs—Program and recursion schemes, type structure; F.3.2 [Logics and meanings of programs]: Semantics of programming languages—Algebraic approaches to semantics; D.3.2 [Programming languages]: Language classifications—Functional languages.
Generic Properties of Datatypes
, 2002
"... Generic programming adds a new dimension to the parametrisation of programs by allowing programs to be dependent on the structure of the data that they manipulate. ..."
Abstract
-
Cited by 3 (1 self)
- Add to MetaCart
Generic programming adds a new dimension to the parametrisation of programs by allowing programs to be dependent on the structure of the data that they manipulate.

