Results 1  10
of
28
Generic programming: An introduction
 3rd International Summer School on Advanced Functional Programming
, 1999
"... ..."
A Typed Pattern Calculus
 ACM Trans. Program. Lang. Syst
, 1996
"... The theory of programming with patternmatching function definitions has been studied mainly in the framework of firstorder rewrite systems. We present a typed functional calculus that emphasizes the strong connection between the structure of whole pattern definitions and their types. In this calcu ..."
Abstract

Cited by 66 (15 self)
 Add to MetaCart
The theory of programming with patternmatching function definitions has been studied mainly in the framework of firstorder rewrite systems. We present a typed functional calculus that emphasizes the strong connection between the structure of whole pattern definitions and their types. In this calculus typechecking guarantees the absence of runtime errors caused by nonexhaustive patternmatching definitions. Its operational semantics is deterministic in a natural way, without the imposition of adhoc solutions such as clause order or "best fit". In the spirit of the CurryHoward isomorphism, we design the calculus as a computational interpretation of the Gentzen sequent proofs for the intuitionistic propositional logic. We prove the basic properties connecting typing and evaluation: subject reduction and strong normalization. We believe that this calculus offers a rational reconstruction of the patternmatching features found in successful functional languages. CNRS and Laboratoire...
A Semantics for Shape
 Science of Computer Programming
, 1995
"... Shapely types separate data, represented by lists, from shape, or structure. This separation supports shape polymorphism, where operations are defined for arbitrary shapes, and shapely operations, for which the shape of the result is determined by that of the input, permitting static shape checking. ..."
Abstract

Cited by 60 (18 self)
 Add to MetaCart
Shapely types separate data, represented by lists, from shape, or structure. This separation supports shape polymorphism, where operations are defined for arbitrary shapes, and shapely operations, for which the shape of the result is determined by that of the input, permitting static shape checking. The shapely types are closed under the formation of fixpoints, and hence include the usual algebraic types of lists, trees, etc. They also include other standard data structures such as arrays, graphs and records. 1 Introduction The values of a shapely type are uniquely determined by their shape and their data. The shape can be thought of as a structure with holes or positions, into which data elements (stored in a list) can be inserted. The use of shape in computing is widespread, but till now it has not, apparently, been the subject of independent study. The body of the paper presents a semantics for shape, based on elementary ideas from category theory. First, let us consider some examp...
A Generic Programming Extension for Haskell
 Utrecht University
, 1999
"... Many functions can be dened completely generically for all datatypes. Examples include pretty printers (eg show), parsers (eg read), data converters, equality and comparison functions, mapping functions, and so forth. This paper proposes a generic programming extension that enables the user to dene ..."
Abstract

Cited by 40 (5 self)
 Add to MetaCart
Many functions can be dened completely generically for all datatypes. Examples include pretty printers (eg show), parsers (eg read), data converters, equality and comparison functions, mapping functions, and so forth. This paper proposes a generic programming extension that enables the user to dene such functions in Haskell. In particular, the proposal aims at generalizing Haskell's deriving construct, which is commonly considered decient since instance declarations can only be derived for a few predened classes. Using generic denitions derived instances can be specied for arbitrary userdened type classes and for classes that abstract over type constructors of rstorder kind. 1 Introduction Generic or polytypic programming aims at relieving the programmer from repeatedly writing functions of similar functionality for dierent datatypes. Typical examples for socalled generic functions include pretty printers (eg show), parsers (eg read), functions that convert data into a u...
Categories of Containers
 In Proceedings of Foundations of Software Science and Computation Structures
, 2003
"... Abstract. We introduce the notion of containers as a mathematical formalisation of the idea that many important datatypes consist of templates where data is stored. We show that containers have good closure properties under a variety of constructions including the formation of initial algebras and f ..."
Abstract

Cited by 40 (7 self)
 Add to MetaCart
Abstract. We introduce the notion of containers as a mathematical formalisation of the idea that many important datatypes consist of templates where data is stored. We show that containers have good closure properties under a variety of constructions including the formation of initial algebras and final coalgebras. We also show that containers include strictly positive types and shapely types but that there are containers which do not correspond to either of these. Further, we derive a representation result classifying the nature of polymorphic functions between containers. We finish this paper with an application to the theory of shapely types and refer to a forthcoming paper which applies this theory to differentiable types. 1
Polytypic Pattern Matching
 In Conference Record of FPCA '95, SIGPLANSIGARCHWG2.8 Conference on Functional Programming Languages and Computer Architecture
, 1995
"... The (exact) pattern matching problem can be informally specified as follows: given a pattern and a text, find all occurrences of the pattern in the text. The pattern and the text may both be lists, or they may both be trees, or they may both be multidimensional arrays, etc. This paper describes a g ..."
Abstract

Cited by 28 (8 self)
 Add to MetaCart
The (exact) pattern matching problem can be informally specified as follows: given a pattern and a text, find all occurrences of the pattern in the text. The pattern and the text may both be lists, or they may both be trees, or they may both be multidimensional arrays, etc. This paper describes a general patternmatching algorithm for all datatypes definable as an initial object in a category of F algebras, where F is a regular functor. This class of datatypes includes mutual recursive datatypes and lots of different kinds of trees. The algorithm is a generalisation of the Knuth, Morris, Pratt like patternmatching algorithm on trees first described by Hoffmann and O'Donnell. 1 Introduction Most editors provide a search function that takes a string of symbols and returns the first position in the text being edited at which this string of symbols occurs. The string of symbols is called a pattern, and the algorithm that detects the position at which a pattern occurs is called a (exa...
Matching Lenses: Alignment and View Update
, 2010
"... Bidirectional programming languages have been proposed as a practical approach to the view update problem. Programs in these languages, often called lenses, can be read in two ways— from left to right as functions mapping sources to views, and from right to left as functions mapping updated views ba ..."
Abstract

Cited by 13 (3 self)
 Add to MetaCart
Bidirectional programming languages have been proposed as a practical approach to the view update problem. Programs in these languages, often called lenses, can be read in two ways— from left to right as functions mapping sources to views, and from right to left as functions mapping updated views back to updated sources. Lenses address the view update problem by making it possible to define a view and its associated update policy together. One issue that has not received sufficient attention in the design of bidirectional languages is alignment. In general, to correctly propagate an update to a view, a lens needs to match up the pieces of the edited view with corresponding pieces of the underlying source. Unfortunately, existing bidirectional languages are extremely limited in their treatment of alignment—they only support simple strategies that do not suffice for many examples of practical interest. In this paper, we propose a novel framework of matching lenses that extends basic lenses with new mechanisms for calculating and using alignments. We enrich the types of lenses with “chunks ” that identify the locations of data that should be realigned after updates, and we formulate refined behavioral laws that capture essential constraints on the handling of chunks. To demonstrate the utility of our approach, we develop a core language of matching lenses for string data, and we extend it with primitives for describing a number of useful alignment heuristics.
Polynomial Polymorphism
 Proceedings of the Eighteenth Australasian Computer Science Conference: Glenelg, South Australia 13 February
, 1995
"... Inductive types, such as lists and trees, have a uniform semantic description, both of the types themselves and the folding algorithms that construct homomorphisms out of them. Though implementations have been able to give a uniform description of the types, this has not been true of folding, since ..."
Abstract

Cited by 12 (4 self)
 Add to MetaCart
Inductive types, such as lists and trees, have a uniform semantic description, both of the types themselves and the folding algorithms that construct homomorphisms out of them. Though implementations have been able to give a uniform description of the types, this has not been true of folding, since there has not been a uniform mechanism for finding the subexpressions (the sublists or subtrees, etc.) to which recursion applies. Polynomial types overcome this problem by distinguishing the indeterminate of the polynomial (on which the recursion occurs) from its coefficients. Further, this uniformity is recognised by the type system, which is able to treat fld as a (shape) polymorphic constant of the calculus. These ideas have been implemented in a language P2. Key words types, polynomials, polymorphism, folding, shape, P2. 1 Introduction The use of initial algebras to describe inductive data types, such as lists and trees, produces a uniform method for describing a large class of ...
∂ for Data: Differentiating Data Structures
"... This paper and our conference paper (Abbott, Altenkirch, Ghani, and McBride, 2003b) explain and analyse the notion of the derivative of a data structure as the type of its onehole contexts based on the central observation made by McBride (2001). To make the idea precise we need a generic notion of ..."
Abstract

Cited by 7 (1 self)
 Add to MetaCart
This paper and our conference paper (Abbott, Altenkirch, Ghani, and McBride, 2003b) explain and analyse the notion of the derivative of a data structure as the type of its onehole contexts based on the central observation made by McBride (2001). To make the idea precise we need a generic notion of a data type, which leads to the notion of a container, introduced in (Abbott, Altenkirch, and Ghani, 2003a) and investigated extensively in (Abbott, 2003). Using containers we can provide a notion of linear map which is the concept missing from McBride’s first analysis. We verify the usual laws of differential calculus including the chain rule and establish laws for initial algebras and terminal coalgebras.
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
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) ...