## Generic programming: An introduction (1999)

Venue: | 3rd International Summer School on Advanced Functional Programming |

Citations: | 83 - 21 self |

### BibTeX

@INPROCEEDINGS{Jansson99genericprogramming:,

author = {Patrik Jansson and Johan Jeuring and Lambert Meertens},

title = {Generic programming: An introduction},

booktitle = {3rd International Summer School on Advanced Functional Programming},

year = {1999},

pages = {28--115},

publisher = {Springer-Verlag}

}

### Years of Citing Articles

### OpenURL

### Abstract

### Citations

381 |
Types, abstraction and parametric polymorphism
- Reynolds
- 1983
(Show Context)
Citation Context ...make do with a brief account of the issues involved. For more detail see [11, 1]. We believe, nevertheless, that a discussion of generic programming would be incomplete without a summary of Reynolds' =-=[40]-=- abstraction theorem which has since been popularised under the name \theorems for free" byWadler [45]. (This summary is taken from [23] which may beconsulted for additional references.)sReynolds' goa... |

339 | Theorems for free
- Wadler
- 1989
(Show Context)
Citation Context ...less, that a discussion of generic programming would be incomplete without a summary of Reynolds' [40] abstraction theorem which has since been popularised under the name \theorems for free" byWadler =-=[45]-=-. (This summary is taken from [23] which may beconsulted for additional references.)sReynolds' goal in establishing the abstraction theorem was to give a precise meaning to the statement that a functi... |

221 | An introduction to the theory of lists
- Bird
- 1987
(Show Context)
Citation Context ...s used in the de nition of pmap, cata, ana, hylo, para and in many other PolyLib functions. Background: The map function was one of the rst combinators distinguished in the work of Bird and Meertens, =-=[12, 35]-=-. The traditional map in functional languages maps a function over a list of elements. The current Haskell version of map is overloaded: map :: Functor f => (a->b) -> f a -> f b and can be used as the... |

221 | A Theorem on Boolean Matrices
- Warshall
- 1962
(Show Context)
Citation Context ... the problem of determining for each pairofnodes x andywhether there is a path in the graph fromxtoy. It is solved by a very elegant (and now well-known) algorithm discovered by Roy [42] and Warshall =-=[46]-=-. The algorithm assumes that the nodes are numbered from 1 toN (say) and that the existence of edges in the graph is given by anNN matrixawhereaij is true if there is an edge from node numberedito the... |

179 | PolyP — a polytypic programming language extension
- Jansson, Jeuring
- 1997
(Show Context)
Citation Context ...or that purpose PolyP type checks de nitions of polytypic functions. This subsection brie y discusses how to type check polytypic functions, the details of the type checking algorithm can be found in =-=[25]-=-. Functor expressions contain +, *, etc., and such expressions have to be translated to real types. For this translation we interpret functor constructors as type synonyms:stype (f + g) a b = Either (... |

107 |
Data structures and program transformation
- Malcolm
- 1990
(Show Context)
Citation Context ...n rewrite. Background: The catamorphism, cata, is the generalisation of the Haskell function foldr and the anamorphism, ana, is the (category theoretic) dual. Catamorphisms were introduced by Malcolm =-=[33, 34]-=-. A hylomorphism is the fused composition of a catamorphism and an anamorphism speci ed by: hylo i o = cata i . ana o. The paramorphism [36], para, is the elimination construct for the type d a from M... |

99 |
and Order in Algorithms
- Law
- 1992
(Show Context)
Citation Context ... functors is a constant functor.) For our current purposes, a complete formalisation is an unnecessary complication and the ad hoc notation introduced above will su ce. Formalisations can be found in =-=[18, 19, 37, 22]-=-. Polynomial functors A functor built only from constants, extractions, sums, products and composition is called a polynomial functor. An example of a polynomial functor is Maybe introduced in section... |

96 |
Algorithmics — towards programming as a mathematical activity
- Meertens
- 1986
(Show Context)
Citation Context ...s used in the de nition of pmap, cata, ana, hylo, para and in many other PolyLib functions. Background: The map function was one of the rst combinators distinguished in the work of Bird and Meertens, =-=[12, 35]-=-. The traditional map in functional languages maps a function over a list of elements. The current Haskell version of map is overloaded: map :: Functor f => (a->b) -> f a -> f b and can be used as the... |

93 | Polytypic programming - Jeuring, Jansson - 1996 |

86 |
Algebraic Data Types and Program Transformation
- Malcolm
- 1990
(Show Context)
Citation Context ...n rewrite. Background: The catamorphism, cata, is the generalisation of the Haskell function foldr and the anamorphism, ana, is the (category theoretic) dual. Catamorphisms were introduced by Malcolm =-=[33, 34]-=-. A hylomorphism is the fused composition of a catamorphism and an anamorphism speci ed by: hylo i o = cata i . ana o. The paramorphism [36], para, is the elimination construct for the type d a from M... |

63 | A semantics for shape - Jay - 1995 |

41 | Calculate polytypically
- Meertens
- 1996
(Show Context)
Citation Context ... functors is a constant functor.) For our current purposes, a complete formalisation is an unnecessary complication and the ad hoc notation introduced above will su ce. Formalisations can be found in =-=[18, 19, 37, 22]-=-. Polynomial functors A functor built only from constants, extractions, sums, products and composition is called a polynomial functor. An example of a polynomial functor is Maybe introduced in section... |

36 | Shapely types and shape polymorphism - Jay, Cockett - 1994 |

30 |
der Woude. Relational catamorphisms
- Backhouse, Bruin, et al.
- 1991
(Show Context)
Citation Context ... ::AB andS ::BC, F idA = idFA for eachA, FRFS(RS for eachR ::AB andS ::AB, (FR) [ =F (R [ ) for eachR ::AB. Relators extend functors A design requirement which led to the above de nition of a relator =-=[4, 5]-=- is that a relator should extend the notion of a functor but in such a way that it coincides with the latter notion when restricted to functions. Formally, relation R ::AB is everywhere de ned or tota... |

28 |
der Woude. Polynomial relators
- Backhouse, Bruin, et al.
- 1992
(Show Context)
Citation Context ... ::AB andS ::BC, F idA = idFA for eachA, FRFS(RS for eachR ::AB andS ::AB, (FR) [ =F (R [ ) for eachR ::AB. Relators extend functors A design requirement which led to the above de nition of a relator =-=[4, 5]-=- is that a relator should extend the notion of a functor but in such a way that it coincides with the latter notion when restricted to functions. Formally, relation R ::AB is everywhere de ned or tota... |

28 | Polytypic pattern matching
- Jeuring
- 1995
(Show Context)
Citation Context ...kground and relationship to other polytypic functions. For example: pmap :: (a -> b) -> d a -> d b Function pmap takes a function f and a value x of datatype d a, and applies f ... Also known as: map =-=[31]-=-, map n [29]. Known uses: Everywhere! Background: This was one of the rst ... A problem with describing a library of polytypic functions is that it is not completely clear how to specify polytypic fun... |

27 | Functorial ML
- Bellè, Jay, et al.
- 1996
(Show Context)
Citation Context ...ra, is a generalised form of cata that gives its parameter function access not only to the results of evaluating the substructures, but also the structure itself. Also known as: PolyLib Functorial ML =-=[9]-=- Squiggol charity [13] cata i fold 1 i ([i]) {| i |} ana o - [(o)] (| o |) Functions cata and para are instances of the Visitor pattern in [21]. Known uses: Very many polytypic functions are de ned us... |

27 |
Monadic maps and folds for arbitrary datatypes. Memoranda Informatica 94-28
- Fokkinga
- 1994
(Show Context)
Citation Context ... generalised in the same way to form even more general combinators. Also known as: traversals [29]. Known uses: in unify and in the parser. Background: Monadic maps and catamorphisms are described in =-=[20]-=-. Monadic anamorphisms and hylomorphisms are de ned in [39]. The monadic map (also called active traversal) is closely related to thread (also called passive traversal): pmapM f = thread . pmap f thre... |

27 |
Relations binaires, fermetures, correspondances de Galois
- Riguet
- 1948
(Show Context)
Citation Context ...ois adjoint, that is, R [ SRS [ � and is contravariant with respect to composition, (RS) [ =S [ R [ : All three operators of an allegory are connected by the modular law, also known as Dedekind's law =-=[41]-=-: RS\T (R\TS [ )S:sNow, a relator is a monotonic functor that commutes with converse. That is, the functor F is a relator i , (3) (4) (5) (6) FRFS =F (RS) for eachR ::AB andS ::BC, F idA = idFA for ea... |

26 |
der Woude. A relational theory of datatypes. Available from www.cs.nott.ac.uk/∼rcb/papers
- Aarts, Backhouse, et al.
- 1992
(Show Context)
Citation Context ...5.2 Parametric Polymorphism Space does not allow usto consider the extension to relations in full depth and so we will have to make do with a brief account of the issues involved. For more detail see =-=[11, 1]-=-. We believe, nevertheless, that a discussion of generic programming would be incomplete without a summary of Reynolds' [40] abstraction theorem which has since been popularised under the name \theore... |

25 |
Algorithm 97
- Floyd
- 1962
(Show Context)
Citation Context ... path problem in which all edges have the same label and all paths have the same weight, namely true. Least-Cost Paths About the same time as Warshall's discovery of the reachability algorithm, Floyd =-=[17]-=- discovered a very similar algorithm that computes the cost of a least cost path between each pair of nodes in the graph. The algorithm assumes that the matrixais a matrix of numbers such thata ij rep... |

25 |
A Generic Theory of Datatypes
- Hoogendijk
- 1997
(Show Context)
Citation Context ... functors is a constant functor.) For our current purposes, a complete formalisation is an unnecessary complication and the ad hoc notation introduced above will su ce. Formalisations can be found in =-=[18, 19, 37, 22]-=-. Polynomial functors A functor built only from constants, extractions, sums, products and composition is called a polynomial functor. An example of a polynomial functor is Maybe introduced in section... |

25 |
Automatic Generation and Use of Abstract Structure Operators
- Sheard
- 1991
(Show Context)
Citation Context ...he elements pairwise. Known uses: fequal is used in the uni cation algorithm to determine when two terms are top level equal. Background: An early version of a polytypic equality function appeared in =-=[44]-=-. Function pequal can be instantiated to give a default for the Haskell Eq-class for regular datatypes: (==) :: Eq a => d a -> d a -> Bool (==) = pequal (==) In Haskell the equality function can be au... |

22 | Datatype laws without signatures
- Fokkinga
- 1996
(Show Context)
Citation Context |

19 | Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations - Bird - 1996 |

18 |
Reductivity arguments and program construction
- Doornbos
- 1996
(Show Context)
Citation Context ...ws: f [ occurs properly inf fR + Rg f [ mem embrV [ f f embrV is a function, de nition of embrVg f [ mem embrV [ f in inr embrV [ 8 A more general proof [7] using the generic theory of F -reductivity =-=[15, 14, 16]-=- avoids this assumption and, indeed, avoids the introduction of the size function altogether.s=ff =g id =([g5embrV ]), computationg f [ mem embrV [ g5embrV id+Ff inr embrV [ =f computationg f [ mem em... |

16 |
De Moor O
- Bird, Jones
- 1997
(Show Context)
Citation Context ...5.2 Parametric Polymorphism Space does not allow usto consider the extension to relations in full depth and so we will have to make do with a brief account of the issues involved. For more detail see =-=[11, 1]-=-. We believe, nevertheless, that a discussion of generic programming would be incomplete without a summary of Reynolds' [40] abstraction theorem which has since been popularised under the name \theore... |

16 | Induction and recursion on datatypes
- Doornbos, Backhouse
- 1995
(Show Context)
Citation Context ...ws: f [ occurs properly inf fR + Rg f [ mem embrV [ f f embrV is a function, de nition of embrVg f [ mem embrV [ f in inr embrV [ 8 A more general proof [7] using the generic theory of F -reductivity =-=[15, 14, 16]-=- avoids this assumption and, indeed, avoids the introduction of the size function altogether.s=ff =g id =([g5embrV ]), computationg f [ mem embrV [ g5embrV id+Ff inr embrV [ =f computationg f [ mem em... |

16 |
Transitivité et Connexité
- Roy
- 1959
(Show Context)
Citation Context ...ability problem is the problem of determining for each pairofnodes x andywhether there is a path in the graph fromxtoy. It is solved by a very elegant (and now well-known) algorithm discovered by Roy =-=[42]-=- and Warshall [46]. The algorithm assumes that the nodes are numbered from 1 toN (say) and that the existence of edges in the graph is given by anNN matrixawhereaij is true if there is an edge from no... |

16 |
Analytical and Structural Polymorphism Expressed Using Patterns Over Types
- Ruehr
- 1992
(Show Context)
Citation Context ...y constructor, but not for all regular types.) A more general (\doubly polytypic") variant of pzip: transpose (called zip.d.e in [23]) transpose :: d (e a) -> e (d a)swas rst described by Fritz Ruehr =-=[43]-=-. For a formal and relational de nition, see Hoogendijk &Backhouse [23]. pzipWith :: ((a,b) -> Maybe c) -> (d a,d b) -> Maybe (d c) pzipWith' :: (FunctorOf d c e -> e) -> ((d a,d b) -> e) -> ((a,b) ->... |

15 | R.: When do datatypes commute
- Hoogendijk, Backhouse
- 1997
(Show Context)
Citation Context ...se of punzip: it takes a pair of structures and zips them together to Just a structure of pairs if the two structures have the same shape, and to Nothing otherwise. Also known as: zip m [29], zip. .d =-=[23]-=-, Known uses: Function fzip is used in the de nition of pzipWith. Background: The traditional function zip zip :: [a] -> [b] -> [(a,b)] combines two lists and does not need the Maybe type in the resul... |

9 |
der Woude, J.: Category theory as coherently constructive lattice theory
- Backhouse, Bijsterveld, et al.
- 1994
(Show Context)
Citation Context ... regular algebra. F ? can be seen as iterating functor F an arbitrary number of times. More signi cantly, the notation highlights a formal link between monads and closure operators. See, for example, =-=[3]-=- for more details. inrs= embl: Note that the catamorphism in the de nition ofgf has pattern functorb K +F , as indicated by the parameter before the semicolon. We omit explicit mention of this informa... |

9 | Calculating path algorithms
- Backhouse, Eijnde, et al.
- 1994
(Show Context)
Citation Context ...re general transitive closure algorithm shown belowsfor eachk, 1kN do for each pair (i�j), 1i�jN end for doa ij :=a ij (a ik (a kk)a kj ) end for is guaranteed to be correct if the algebra is regular =-=[6, 8]-=- 2 . By correctness is meant that if initially aij =he:eis an edge fromitoj: labelei� where is the generalisation of the binary operator to arbitrary bags, then on termination aij =hp:p is a path of p... |

7 |
Augustsson. Cayenne - a language with dependent types
- Lennart
- 1998
(Show Context)
Citation Context ...mitations. Types can be de ned and used as parameters, but::: types can only be given as parameters in \type expressions". They cannot be passed to functions. The recent Haskell-like language Cayenne =-=[2]-=- which extends Haskell with dependent types does allow types as arguments and results of functions. In these lecture notes we introduce another dimension to the level of abstraction in programming lan... |

5 | Functional polytypic programming | use and implementation - Jansson - 1997 |

4 |
Regular algebra applied to path- nding problems
- Backhouse, Carre
- 1975
(Show Context)
Citation Context ...re general transitive closure algorithm shown belowsfor eachk, 1kN do for each pair (i�j), 1i�jN end for doa ij :=a ij (a ik (a kk)a kj ) end for is guaranteed to be correct if the algebra is regular =-=[6, 8]-=- 2 . By correctness is meant that if initially aij =he:eis an edge fromitoj: labelei� where is the generalisation of the binary operator to arbitrary bags, then on termination aij =hp:p is a path of p... |

3 |
Oege de Moor. What is a datatype
- Hoogendijk
- 1996
(Show Context)
Citation Context ...neric uni cation algorithm we also need to know that a membership relation can be de ned on a datatype. The full theory of membership and its consequences has been developed by Hoogendijk and De Moor =-=[24, 22]-=-. Here we give only a very brief account. LetF be a relator. A membership relation onF is a parametrically polymorphic relation mem of typeaFa for alla. Parametricity meansthat for all relationsR, mem... |

1 |
Fixed point calculus applied to generic programming: Part 1
- Backhouse
- 1998
(Show Context)
Citation Context ...of to the reader. The second is proved as follows: f [ occurs properly inf fR + Rg f [ mem embrV [ f f embrV is a function, de nition of embrVg f [ mem embrV [ f in inr embrV [ 8 A more general proof =-=[7]-=- using the generic theory of F -reductivity [15, 14, 16] avoids this assumption and, indeed, avoids the introduction of the size function altogether.s=ff =g id =([g5embrV ]), computationg f [ mem embr... |

1 |
Functional pearl: Polytypic uni cation
- Jansson, Jeuring
- 1998
(Show Context)
Citation Context ...ual is de ned in PolyLib, see Section 3.6. instance TopEq (F ? V ) where topEq (t�t 0 ) = fequal (==) (x7!y7! True)(outt)(outt 0 ) For a complete implementation of the generic uni cation program, see =-=[26]-=-.s5 From Functions to Relations In the preceding chapter we have done what we ourselves have decried: we have presented an algorithm without even a veri cation of its correctness, let alone a construc... |

1 |
Functorial ML. Extended version of [9] in press for Journal of Functional Programming '98
- Jay, Belle, et al.
- 1998
(Show Context)
Citation Context ...relationship to other polytypic functions. For example: pmap :: (a -> b) -> d a -> d b Function pmap takes a function f and a value x of datatype d a, and applies f ... Also known as: map [31], map n =-=[29]-=-. Known uses: Everywhere! Background: This was one of the rst ... A problem with describing a library of polytypic functions is that it is not completely clear how to specify polytypic functions. The ... |

1 |
Monadic corecursion |de nition, fusion laws, and applications
- Pardo
- 1998
(Show Context)
Citation Context ...inators. Also known as: traversals [29]. Known uses: in unify and in the parser. Background: Monadic maps and catamorphisms are described in [20]. Monadic anamorphisms and hylomorphisms are de ned in =-=[39]-=-. The monadic map (also called active traversal) is closely related to thread (also called passive traversal): pmapM f = thread . pmap f thread = pmapM id propagate :: d (Maybe a) -> Maybe (d a) cross... |