## Generalised Folds for Nested Datatypes (1999)

Venue: | Formal Aspects of Computing |

Citations: | 36 - 1 self |

### BibTeX

@ARTICLE{Bird99generalisedfolds,

author = {Richard Bird and Ross Paterson},

title = {Generalised Folds for Nested Datatypes},

journal = {Formal Aspects of Computing},

year = {1999},

volume = {11},

pages = {11--2}

}

### Years of Citing Articles

### OpenURL

### Abstract

Nested datatypes generalise regular datatypes in much the same way that context-free languages generalise regular ones. Although the categorical semantics of nested types turns out to be similar to the regular case, the fold functions are more limited because they can only describe natural transformations. Practical considerations therefore dictate the introduction of a generalised fold function in which this limitation can be overcome. In the paper we show how to construct generalised folds systematically for each nested datatype, and show that they possess a uniqueness property analogous to that of ordinary folds. As a consequence, generalised folds satisfy fusion properties similar to those developed for regular datatypes. Such properties form the core of an effective calculational theory of inductive datatypes.

### Citations

986 | Categories for the Working Mathematician - Lane - 1971 |

243 | Purely Functional Data Structures
- Okasaki
- 1998
(Show Context)
Citation Context ...ture certain structural invariants in a way that regular datatypes cannot. Connelly and Lockwood Morris [CL95] use a nested type for modelling a generalisation of the trie data structure, and Okasaki =-=[Oka98]-=- puts nested datatypes to a variety of uses in the design of purely functional data structures. Bird and Paterson [BP99] use a nested datatype to describe de Bruijn notation for lambda expressions. Ot... |

228 | Introduction to Functional Programming using Haskell - Bird - 1998 |

107 | Data structures and program transformation - Malcolm - 1990 |

91 | Algebraic Approaches to Program Semantics - Manes, Arbib - 1986 |

86 | Algebraic Data Types and Program Transformation - Malcolm - 1990 |

84 | Nested datatypes
- Bird, Meertens
- 1998
(Show Context)
Citation Context ...ons include AVL trees, 2-3 trees, and square matrices. The aim of this paper is to lay the groundwork for a useful calculational theory of nested datatypes; the work can be regarded as a successor to =-=[BM98]-=-. The categorical semantics is straightforward, but there is a complication. For a regular datatype, the fold function induced by initiality is a useful tool in the construction of practical programs.... |

72 | De Bruijn notation as a nested datatype
- Bird, Paterson
- 1999
(Show Context)
Citation Context ...ed type for modelling a generalisation of the trie data structure, and Okasaki [Oka98] puts nested datatypes to a variety of uses in the design of purely functional data structures. Bird and Paterson =-=[BP99]-=- use a nested datatype to describe de Bruijn notation for lambda expressions. Other examples of datatypes that have been shown very recently to be expressible by nested declarations include AVL trees,... |

33 | Category Theoretic Approach to Data Types - Hagino - 1987 |

26 | Improving programs which recurse over multiple inductive structures
- Fegaras, Sheard, et al.
- 1994
(Show Context)
Citation Context ...eralised fold reduces to an ordinary fold. Further instances are dening equations of the form x L = f G x g for functions f :: G B ! B and g :: L F ! G L. For example, ziplike functions [FSZ94] are of this form, with L = (a binary functor) and g :: F 1 F 2 ! G . Furthermore, this uniqueness property leads to a general fusion law, stating that for any natural transformation :: 8A: (... |

26 |
The typechecking of programs with implicit type structure
- McCracken
- 1984
(Show Context)
Citation Context ...F Y . In Haskell, we have listF :: (8 a: x a ! y a) ! ListF x b ! ListF y b listF f = base id f Thesrst arguments of hfold and listF are polymorphic functions, described using a rank 2 type signature =-=[McC84-=-]. Such signatures are allowed in recent extensions to Haskell [Jon98, PL97]. Polymorphic functions correspond to natural transformations in a categorical setting. The denition of hfold is equivalent ... |

19 | A Generic Theory of Data Types - Hoogendijk - 1997 |

14 |
A generalisation of the trie data structure
- Connelly, Morris
- 1995
(Show Context)
Citation Context ...lanced binary tree with labels in the leaves. As this example suggests, nested datatypes can capture certain structural invariants in a way that regular datatypes cannot. Connelly and Lockwood Morris =-=[CL95]-=- use a nested type for modelling a generalisation of the trie data structure, and Okasaki [Oka98] puts nested datatypes to a variety of uses in the design of purely functional data structures. Bird an... |

6 | A technical summary of the new features - Jones - 1998 |

3 | Explicit quanti in Haskell - Jones, Simon - 1998 |

2 |
Designing arithmetic circuits by re in ruby
- Jones, Sheeran
- 1993
(Show Context)
Citation Context ...a 1 (g 2 a 2 (g n a n e) )): The regular fold is the special case of a list reduction in which g = id . List reductions are an important component of the circuit design language Ruby [JS93]; see also [BdM97]. This analysis of reductions suggests that a generalised fold over lists can be decomposed into a simple fold after a triangle. The triangle with respect to a function g takes [a 0 ... |