## Calculate Polytypically! (1996)

Venue: | In PLILP'96, volume 1140 of LNCS |

Citations: | 41 - 3 self |

### BibTeX

@INPROCEEDINGS{Meertens96calculatepolytypically!,

author = {Lambert Meertens},

title = {Calculate Polytypically!},

booktitle = {In PLILP'96, volume 1140 of LNCS},

year = {1996},

pages = {1--16},

publisher = {Springer-Verlag}

}

### Years of Citing Articles

### OpenURL

### Abstract

A polytypic function definition is a function definition that is parametrised with a datatype. It embraces a class of algorithms. As an example we define a simple polytypic "crush" combinator that can be used to calculate polytypically. The ability to define functions polytypically adds another level of flexibility in the reusability of programming idioms and in the design of libraries of interoperable components.

### Citations

330 | Theorems for Free
- WADLER
- 1989
(Show Context)
Citation Context ...h fusion. If the following three equations are satisfied: h . \Phi =\Omega . h \Theta h hs\Phi = \Omega h . f = g then h . hh\Phi; f ii = hh\Omega ; gii 2 This is basically the "free theorem"=-=; (Wadler [37]-=-) for polytypic crush, but a bit of fudging with the type is needed to handle the neutral elements. Jeuring and Jansson [22] show how to derive these for polytypic functions in general. We can use thi... |

301 | Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire
- MEIJER, FOKKINGA, et al.
- 1991
(Show Context)
Citation Context ...ty to parametrise a function definition with a type. A function thus parametrised is called polytypic. The "derived" functions of Haskell are all polytypic, as are catamorphisms and friends =-=[24] [29] [31]-=-. The standard foldr combinator is just the instantiation of the cata combinator for the datatype constructor List. While a polymorphic function stands for one algorithm that happens to be insensitive... |

216 |
An introduction to the theory of lists
- Bird
- 1987
(Show Context)
Citation Context ...ehr [33]), "generic programming" (de Moor [5], Bird, de Moor and Hoogendijk [4]) and "type parametric programming" (Sheard [34]). 3 Some historical remarks In what I'll refer to as=-= "classic BMF" [28] [2], a.k.a. &-=-quot;Squiggol", the focus was on lists, with particular emphasis on a symmetric view in which lists are built up from the empty-list constructor [ ], the singleton-list constructor [ ], and an as... |

111 | A fold for all seasons
- Sheard, Fegaras
- 1993
(Show Context)
Citation Context ...or List . 8 Polytypic crush The key to polytypic type definitions (given the present state of the art --- no Polyps From Outer Space yet but see Freyd [12], Meijer and Hutton [32], Sheard and Fegaras =-=[35]-=- and Fegaras and Sheard [6] for possible extensions) is the formal grammar for regular functions. The class of regular functors is itself like (and can be modelled by) an inductive datatype, and so po... |

105 |
Data structures and program transformation
- Malcolm
- 1990
(Show Context)
Citation Context ...to the development of "constructive algorithmics " as a discipline for calculational program construction encompassing much more than the theory of lists, however fertile by itself. Malcolm =-=[24] [25] [26]-=- showed how to generalise essential parts of the theory to other initial datatypes, based on a categorical approach (Manes and Arbib [27], Hagino [13]). Fokkinga [7] [8] [11] honed the categorically-i... |

97 |
and Order in Algorithmics
- Law
- 1992
(Show Context)
Citation Context ...tile by itself. Malcolm [24] [25] [26] showed how to generalise essential parts of the theory to other initial datatypes, based on a categorical approach (Manes and Arbib [27], Hagino [13]). Fokkinga =-=[7]-=- [8] [11] honed the categorically-inspired calculational techniques to a fine edge. While the theory developed by Malcolm and Fokkinga gave the basic tools needed for polytypic definitions, its applic... |

96 |
de Moor, O.: Algebras of Programming
- Bird
- 1996
(Show Context)
Citation Context ...d de Moor on solving a variety of optimisation problems by calculation was polytypically unified by de Moor in [5]. Several further examples of polytypic calculations can be found in Bird and de Moor =-=[3]-=-. The most impressive polytypic algorithms today are those developed by Jeuring and his group, such as Jeuring's polytypic pattern-matching algorithm [21]. Jansson [17] presents a polytypic unificatio... |

95 | Bananas in space: extending fold and unfold to exponential types
- Meijer, Hutton
- 1995
(Show Context)
Citation Context ...esponds to the type functor List . 8 Polytypic crush The key to polytypic type definitions (given the present state of the art --- no Polyps From Outer Space yet but see Freyd [12], Meijer and Hutton =-=[32]-=-, Sheard and Fegaras [35] and Fegaras and Sheard [6] for possible extensions) is the formal grammar for regular functions. The class of regular functors is itself like (and can be modelled by) an indu... |

86 |
Algebraic Approaches to Program Semantics
- Manes, Arbib
- 1986
(Show Context)
Citation Context ... theory of lists, however fertile by itself. Malcolm [24] [25] [26] showed how to generalise essential parts of the theory to other initial datatypes, based on a categorical approach (Manes and Arbib =-=[27]-=-, Hagino [13]). Fokkinga [7] [8] [11] honed the categorically-inspired calculational techniques to a fine edge. While the theory developed by Malcolm and Fokkinga gave the basic tools needed for polyt... |

84 |
Algebraic data types and program transformation
- Malcolm
- 1990
(Show Context)
Citation Context ...bute to the development of "constructive algorithmics " as a discipline for calculational program construction encompassing much more than the theory of lists, however fertile by itself. Mal=-=colm [24] [25]-=- [26] showed how to generalise essential parts of the theory to other initial datatypes, based on a categorical approach (Manes and Arbib [27], Hagino [13]). Fokkinga [7] [8] [11] honed the categorica... |

81 | The design of a pretty-printing library
- Hughes
- 1995
(Show Context)
Citation Context ...ry. Mathematics likewise gets its leverage from abstraction, by going from the specific to the general. Essential to the expression of abstraction is the ability to parametrise. John Hughes argues in =-=[15]-=- that the ability to name and reuse --- i.e., to parametrise --- is at the heart of the functional languages' power. Standard combinators (higher-order functions) like map and foldr capture very gener... |

69 | Functional Programming with Overloading and Higher-Order Polymorphism - Jones - 1995 |

68 |
Recursive types reduced to induct,ive types
- Freyd
- 1990
(Show Context)
Citation Context ...tions. The embeddedscorresponds to the type functor List . 8 Polytypic crush The key to polytypic type definitions (given the present state of the art --- no Polyps From Outer Space yet but see Freyd =-=[12]-=-, Meijer and Hutton [32], Sheard and Fegaras [35] and Fegaras and Sheard [6] for possible extensions) is the formal grammar for regular functions. The class of regular functors is itself like (and can... |

55 | Revisiting catamorphisms over datatypes with embedded functions
- Fegaras, Sheard
- 1996
(Show Context)
Citation Context ...The key to polytypic type definitions (given the present state of the art --- no Polyps From Outer Space yet but see Freyd [12], Meijer and Hutton [32], Sheard and Fegaras [35] and Fegaras and Sheard =-=[6]-=- for possible extensions) is the formal grammar for regular functions. The class of regular functors is itself like (and can be modelled by) an inductive datatype, and so polytypic functions can be de... |

35 |
Homomorphisms and promotability
- Malcolm
- 1989
(Show Context)
Citation Context ... the ability to parametrise a function definition with a type. A function thus parametrised is called polytypic. The "derived" functions of Haskell are all polytypic, as are catamorphisms an=-=d friends [24]-=- [29] [31]. The standard foldr combinator is just the instantiation of the cata combinator for the datatype constructor List. While a polymorphic function stands for one algorithm that happens to be i... |

32 |
Category theoretic approach to data types
- Hagino
- 1987
(Show Context)
Citation Context ...sts, however fertile by itself. Malcolm [24] [25] [26] showed how to generalise essential parts of the theory to other initial datatypes, based on a categorical approach (Manes and Arbib [27], Hagino =-=[13]-=-). Fokkinga [7] [8] [11] honed the categorically-inspired calculational techniques to a fine edge. While the theory developed by Malcolm and Fokkinga gave the basic tools needed for polytypic definiti... |

28 | Polytypic pattern matching
- Jeuring
- 1995
(Show Context)
Citation Context ... calculations can be found in Bird and de Moor [3]. The most impressive polytypic algorithms today are those developed by Jeuring and his group, such as Jeuring's polytypic pattern-matching algorithm =-=[21]-=-. Jansson [17] presents a polytypic unification algorithm (see also Jansson and Jeuring [19]). Although not derived calculationally, these algorithms provide strong evidence of the potential of polyty... |

26 |
Monadic Maps and Folds for Arbitrary Datatypes. Memoranda Informatica 94-28
- Fokkinga
- 1994
(Show Context)
Citation Context ...ll defined. Incorporating type functors into the ways of constructing functors extends the class of polynomial functors to the class of regular functors. 7 Regular functors The definition of Fokkinga =-=[10]-=- will be followed, with one minor modification. A functor built only from constants, extractions, sums, products, composition andsis called a regular functor. A formal grammar for the n-ary regular fu... |

23 | A Gentle Introduction to Category Theory - The calculational approach
- Fokkinga
- 1994
(Show Context)
Citation Context ...egory theory, but no knowledge of category theory is needed to follow the exposition here. Gentle introductions to category theory that are inspired by its use for program calculation can be found in =-=[9]-=- and [30]. Ex n i f 0 \Delta \Delta \Delta f n\Gamma1 = f i ; i = 0; : : : ; n \Gamma 1 is an n-ary functor. We write Id for the unary functor Ex 1 0 , and Exl and Exr for the binary functors Ex 2 0 a... |

22 | Datatype Laws without Signatures
- Fokkinga
- 1996
(Show Context)
Citation Context ...itself. Malcolm [24] [25] [26] showed how to generalise essential parts of the theory to other initial datatypes, based on a categorical approach (Manes and Arbib [27], Hagino [13]). Fokkinga [7] [8] =-=[11]-=- honed the categorically-inspired calculational techniques to a fine edge. While the theory developed by Malcolm and Fokkinga gave the basic tools needed for polytypic definitions, its application to ... |

19 |
Polytypic unification
- Jansson, Jeuring
- 1998
(Show Context)
Citation Context ...can be found in Bird and de Moor [3]. The most impressive polytypic algorithms today are those developed by Jeuring and his group, such as Jeuring's polytypic pattern-matching algorithm [21]. Jansson =-=[17]-=- presents a polytypic unification algorithm (see also Jansson and Jeuring [19]). Although not derived calculationally, these algorithms provide strong evidence of the potential of polytypic definition... |

18 |
Oege de Moor, and Paul Hoogendijk. Generic functional programming with types and relations
- Bird
- 1996
(Show Context)
Citation Context ...ypic function; see e.g. Sheard [34]. Other terms that have been used for the same concept are "structural polymorphism " (Ruehr [33]), "generic programming" (de Moor [5], Bird, de =-=Moor and Hoogendijk [4]) and "type parametric pr-=-ogramming" (Sheard [34]). 3 Some historical remarks In what I'll refer to as "classic BMF" [28] [2], a.k.a. "Squiggol", the focus was on lists, with particular emphasis on a s... |

15 |
Analytical and Structural Polymorphism Expressed Using Patterns Over Types
- Ruehr
- 1992
(Show Context)
Citation Context ...somewhat and hardly. However, eq is --- or can be defined as --- a polytypic function; see e.g. Sheard [34]. Other terms that have been used for the same concept are "structural polymorphism &quo=-=t; (Ruehr [33]), "generic programming&q-=-uot; (de Moor [5], Bird, de Moor and Hoogendijk [4]) and "type parametric programming" (Sheard [34]). 3 Some historical remarks In what I'll refer to as "classic BMF" [28] [2], a.k... |

14 |
Algorithmics--towards programming as a mathematical activity
- Meertens
- 1986
(Show Context)
Citation Context ..." (Ruehr [33]), "generic programming" (de Moor [5], Bird, de Moor and Hoogendijk [4]) and "type parametric programming" (Sheard [34]). 3 Some historical remarks In what I'll r=-=efer to as "classic BMF" [28] [2], a.k.-=-a. "Squiggol", the focus was on lists, with particular emphasis on a symmetric view in which lists are built up from the empty-list constructor [ ], the singleton-list constructor [ ], and a... |

13 | A generic program for sequential decision processes
- Moor
- 1995
(Show Context)
Citation Context ...- or can be defined as --- a polytypic function; see e.g. Sheard [34]. Other terms that have been used for the same concept are "structural polymorphism " (Ruehr [33]), "generic program=-=ming" (de Moor [5], Bird, de Moor and Hoogendijk-=- [4]) and "type parametric programming" (Sheard [34]). 3 Some historical remarks In what I'll refer to as "classic BMF" [28] [2], a.k.a. "Squiggol", the focus was on list... |

9 | A class of commuting relators - Backhouse, Doornbos, et al. - 1992 |

6 | A Categorical Approach to Functional Programming - Tuijnman - 1995 |

5 | The calculation of a polytypic parser
- Huisman
- 1996
(Show Context)
Citation Context ... polytypic unification algorithm (see also Jansson and Jeuring [19]). Although not derived calculationally, these algorithms provide strong evidence of the potential of polytypic definitions. Huisman =-=[16] defines a-=- polytypic function unparser --- rather like polytypic flatten but with extra "hooks" for plugging in concrete syntax --- and calculates a polytypic parser from it by function inversion. By ... |

4 | Calculate categorically
- Fokkinga
- 1992
(Show Context)
Citation Context ... by itself. Malcolm [24] [25] [26] showed how to generalise essential parts of the theory to other initial datatypes, based on a categorical approach (Manes and Arbib [27], Hagino [13]). Fokkinga [7] =-=[8]-=- [11] honed the categorically-inspired calculational techniques to a fine edge. While the theory developed by Malcolm and Fokkinga gave the basic tools needed for polytypic definitions, its applicatio... |

4 |
Type parametric programming with compile-time reflection
- Sheard
- 1993
(Show Context)
Citation Context ...The polytypic functionss2F and sum F are as polymorphic as eq and + are, which is, respectively, somewhat and hardly. However, eq is --- or can be defined as --- a polytypic function; see e.g. Sheard =-=[34]. Other terms that have b-=-een used for the same concept are "structural polymorphism " (Ruehr [33]), "generic programming" (de Moor [5], Bird, de Moor and Hoogendijk [4]) and "type parametric programmi... |

3 |
Polytypic unification --- implementing polytypic functions with constructor classes
- Jansson, Jeuring
- 1996
(Show Context)
Citation Context ... today are those developed by Jeuring and his group, such as Jeuring's polytypic pattern-matching algorithm [21]. Jansson [17] presents a polytypic unification algorithm (see also Jansson and Jeuring =-=[19]-=-). Although not derived calculationally, these algorithms provide strong evidence of the potential of polytypic definitions. Huisman [16] defines a polytypic function unparser --- rather like polytypi... |

3 |
Type inference for polytypic functions
- Jansson, Jeuring
- 1996
(Show Context)
Citation Context ...e possibilities to get it wrong but type correct are, if not crushed, then at least definitely reduced. Hindley-Milner style type inference for polytypic functions is described by Jansson and Jeuring =-=[20]-=-. Also, the polytypic version may be genuinely simpler. Just compare the polytypic definitions of e2 and sum with the versions specialised for Rose from Section 2. I started the Introduction with a qu... |

2 | PolyP: a polytypic programming language - Jansson, Jeuring - 1997 |

2 |
Category Theory for Program Construction by Calculation. Lecture Notes for ESSLLI'95
- Meertens
- 1995
(Show Context)
Citation Context ...eory, but no knowledge of category theory is needed to follow the exposition here. Gentle introductions to category theory that are inspired by its use for program calculation can be found in [9] and =-=[30]-=-. Ex n i f 0 \Delta \Delta \Delta f n\Gamma1 = f i ; i = 0; : : : ; n \Gamma 1 is an n-ary functor. We write Id for the unary functor Ex 1 0 , and Exl and Exr for the binary functors Ex 2 0 and Ex 2 1... |

1 | Generators, Destructors and Natural Transformations - Hoogendijk - 1993 |

1 |
Polytypic programming. To appear
- Jeuring, Jansson
- 1996
(Show Context)
Citation Context ...h\Phi; f ii = hh\Omega ; gii 2 This is basically the "free theorem" (Wadler [37]) for polytypic crush, but a bit of fudging with the type is needed to handle the neutral elements. Jeuring an=-=d Jansson [22]-=- show how to derive these for polytypic functions in general. We can use this fusion law to find a condition under which hh\Phi; f ii List . flatten = hh\Phi; f ii Using flatten = hh++; [ ]ii and putt... |