Results 1  10
of
15
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 socalled 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 108 (19 self)
 Add to MetaCart
(Show Context)
A polytypic value is one that is defined by induction on the structure of types. In Haskell the type structure is described by the socalled 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 higherorder functors. Polytypic values enjoy polytypic properties. Using kindindexed logical relations we prove...
Generic Programming — An Introduction
 3rd International Summer School on Advanced Functional Programming
, 1999
"... ..."
(Show Context)
Generic Downwards Accumulations
 Science of Computer Programming
, 2000
"... . A downwards accumulation is a higherorder 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 24 (5 self)
 Add to MetaCart
. A downwards accumulation is a higherorder 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 coinductive. 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 ...
Extensibility for the masses: Practical extensibility with object algebras
 IN: ECOOP’12
, 2012
"... This paper presents a new solution to the expression problem (EP) that works in OO languages with simple generics (including Java or C#). A key novelty of this solution is that advanced typing features, including Fbounded quantification, wildcards and variance annotations, are not needed. The solu ..."
Abstract

Cited by 8 (4 self)
 Add to MetaCart
This paper presents a new solution to the expression problem (EP) that works in OO languages with simple generics (including Java or C#). A key novelty of this solution is that advanced typing features, including Fbounded quantification, wildcards and variance annotations, are not needed. The solution is based on object algebras, which are an abstraction closely related to algebraic datatypes and Church encodings. Object algebras also have much in common with the traditional forms of the Visitor pattern, but without many of its drawbacks: they are extensible, remove the need for accept methods, and do not compromise encapsulation. We show applications of object algebras that go beyond toy examples usually presented in solutions for the expression problem. In the paper we develop an increasingly more complex set of features for a miniimperative language, and we discuss a realworld application of object algebras in an implementation of remote batches. We believe that object algebras bring extensibility to the masses: object algebras work in mainstream OO languages, and they significantly reduce the conceptual overhead by using only features that are used by everyday programmers.
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...
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 userdefined 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
(Show Context)
This paper describes structural polymorphism, a new form of type polymorphism appropriate to functional languages featuring userdefined 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) redefined 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 boundvariable/expression pair. By analogy with pattern abstractions, we generalize polymorphic type abstractions (Òå.e) to typepattern abstractions, which are comprised of multiple typepattern/expression pairs. The types given to typepattern 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) ...
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 5 (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 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 5 (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.
Parametric DatatypeGenericity
"... Datatypegeneric programs are programs that are parametrized by a datatype or type functor: whereas polymorphic programs abstract from the ‘integers ’ in ‘lists of integers’, datatypegeneric programs abstract from the ‘lists of’. There are two main styles of datatypegeneric programming: the Algebr ..."
Abstract

Cited by 4 (2 self)
 Add to MetaCart
(Show Context)
Datatypegeneric programs are programs that are parametrized by a datatype or type functor: whereas polymorphic programs abstract from the ‘integers ’ in ‘lists of integers’, datatypegeneric programs abstract from the ‘lists of’. There are two main styles of datatypegeneric 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 datatypegeneric 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 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 4 (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.