## Nested Datatypes (1998)

Citations: | 83 - 5 self |

### BibTeX

@MISC{Bird98nesteddatatypes,

author = {Richard Bird and Lambert Meertens},

title = {Nested Datatypes},

year = {1998}

}

### Years of Citing Articles

### OpenURL

### Abstract

. A nested datatype, also known as a non-regular datatype, is a parametrised datatype whose declaration involves different instances of the accompanying type parameters. Nested datatypes have been mostly ignored in functional programming until recently, but they are turning out to be both theoretically important and useful in practice. The aim of this paper is to suggest a functorial semantics for such datatypes, with an associated calculational theory that mirrors and extends the standard theory for regular datatypes. Though elegant and generic, the proposed approach appears more limited than one would like, and some of the limitations are discussed. Hark, by the bird's song ye may learn the nest. Tennyson The Marriage of Geraint 1 Introduction Consider the following three datatype definitions, all of which are legal Haskell declarations: data List a = NilL j ConsL (a; List a) data Nest a = NilN j ConsN (a; Nest (a; a)) data Bush a = NilB j ConsB (a; Bush (Bush a)) The...

### Citations

265 |
Categories for the working mathematician, Graduate Texts
- Lane
- 1998
(Show Context)
Citation Context ...nuous. The proof for polynomial functors can be found in [14], and the extension to type functors is in [13]. Moreover, the category Nat (Fun) inherits co-completeness from the base category Fun (see =-=[11,7]-=-). We believe that all regular higher-order functors are co-continuous, though we have not yet found a proof of this in the literature, so the existence of datatypes like Nest and Bush is not likely t... |

243 | Purely Functional Data Structures
- Okasaki
- 1998
(Show Context)
Citation Context ...ard Haskell. The upshot of the current situation is that nested datatypes have been rather neglected in functional programming. However, they are conceptually important and evidence is emerging (e.g. =-=[3,18,19]-=-) of their usefulness in functional data structure design. A brief illustration of what they can offer is given in Section 2. Regular datatypes, on the other hand, are the bread and butter of function... |

107 |
Data structures and program transformation
- Malcolm
- 1990
(Show Context)
Citation Context ...List), the identity and projection functors, using coproduct, product, and composition operations,Nested Datatypes 57 are called regular functors. For further details of the approach, consult, e.g., =-=[12]-=- or [1]. For Nest and Bush the theory above breaks down. For example, introducing Qa =a×a for the squaring functor, the corresponding functorial declaration for Nest would be data Nest a αa ←− F (a , ... |

98 |
Polymorphic type schemes and recursive definitions
- Mycroft
- 1984
(Show Context)
Citation Context ...(counting from 0) of a list of type Bush a has type Bush n a. The datatype List a is an example of a so-called regular datatype, while Nest a and Bush a are examples of non-regular datatypes. Mycroft =-=[17]-=- calls such schemes polymorphic recursions. We prefer the term nested datatypes. In a regular datatype declaration, occurrences of the declared type on the right-hand side of the defining equation are... |

96 | Bananas in Space: Extending Fold and Unfold to Exponential Types
- Meijer, Hutton
- 1995
(Show Context)
Citation Context ...ard functorial semantics of regular datatypes may be recovered as a special case. It is important to note that we will not consider datatype declarations containing function spaces in this paper; see =-=[6,16]-=- for ways of dealing with function spaces in datatype declarations. 2 An example Let us begin with a small example to show the potential of nested datatypes. The example was suggested to us by Oege de... |

95 |
Algebraically complete categories
- Freyd
- 1990
(Show Context)
Citation Context ...ies are “bushed”. For example, one value of type Bush Int is Johan Jeuring (Ed.): MPC’98, LNCS 1422, pp. 52–67, 1998. c○ Springer-Verlag Berlin Heidelberg 1998Nested Datatypes 53 [4, [8,[5],[[3]]], [=-=[7]-=-,[],[[[7]]]], [[[],[[0]]]] ] This bush contains four entries, the first of which is an element of Int, the second an element of Bush Int, the third an element of Bush (Bush Int), and so on. In general... |

90 |
Algebraic approaches to program semantics
- Arbib, Manes
- 1986
(Show Context)
Citation Context ...un has everything needed to make this incantation work: Fun is co-complete (in fact, bi-complete) and all regular functors F on Fun are cocontinuous. The proof for polynomial functors can be found in =-=[14]-=-, and the extension to type functors is in [13]. Moreover, the category Nat (Fun) inherits co-completeness from the base category Fun (see [11,7]). We believe that all regular higher-order functors ar... |

85 |
Algebraic Data Types and Program Transformation
- Malcolm
- 1990
(Show Context)
Citation Context ...on work: Fun is co-complete (in fact, bi-complete) and all regular functors F on Fun are cocontinuous. The proof for polynomial functors can be found in [14], and the extension to type functors is in =-=[13]-=-. Moreover, the category Nat (Fun) inherits co-completeness from the base category Fun (see [11,7]). We believe that all regular higher-order functors are co-continuous, though we have not yet found a... |

62 |
A fixpoint theorem for complete categories
- Lambek
- 1968
(Show Context)
Citation Context ...is to define a regular datatype as an initial object in a category of F -algebras for an appropriate functor F . Indeed, this idea appeared much earlier in the categorical literature, for instance in =-=[10]-=-. As a consequence, polytypic programs are parametrised by one or more regular functors. Different instances of these functors yield the concrete programs we know and love.54 Richard Bird and Lambert... |

56 | Revisiting catamorphisms over datatypes with embedded functions (or, Programs from outer space
- Fegaras, Sheard
- 1996
(Show Context)
Citation Context ...ard functorial semantics of regular datatypes may be recovered as a special case. It is important to note that we will not consider datatype declarations containing function spaces in this paper; see =-=[6,16]-=- for ways of dealing with function spaces in datatype declarations. 2 An example Let us begin with a small example to show the potential of nested datatypes. The example was suggested to us by Oege de... |

41 | Calculate polytypically
- Meertens
- 1996
(Show Context)
Citation Context ...A brief illustration of what they can offer is given in Section 2. Regular datatypes, on the other hand, are the bread and butter of functional programming. Recent work on polytypic programming (e.g. =-=[2,9,15]-=-) has systematised the mathematics of program construction with regular datatypes by focusing on a small number of generic operators, such as fold, thatcanbe defined for all such types. The basic idea... |

32 |
Category theoretic approach to data types
- Hagino
- 1987
(Show Context)
Citation Context ...ition of lift) the programs above are acceptable to Haskell 1.4, provided the type signatures are included as part of the definitions. 3 Datatypes as initial algebras The standard semantics (see e.g. =-=[8,10]-=-) of inductive datatypes parametrised by n type parameters employs functors of type C×···×C→C, where the product has n + 1 occurrences of C. For simplicity, we will consider only the case n =1. The ca... |

28 | Polytypic pattern matching
- Jeuring
- 1995
(Show Context)
Citation Context ...A brief illustration of what they can offer is given in Section 2. Regular datatypes, on the other hand, are the bread and butter of functional programming. Recent work on polytypic programming (e.g. =-=[2,9,15]-=-) has systematised the mathematics of program construction with regular datatypes by focusing on a small number of generic operators, such as fold, thatcanbe defined for all such types. The basic idea... |

18 |
A Generic Theory of Data Types
- Hoogendijk
- 1997
(Show Context)
Citation Context ...he list, entries are “bushed”. For example, one value of type Bush Int is Johan Jeuring (Ed.): MPC’98, LNCS 1422, pp. 52–67, 1998. c○ Springer-Verlag Berlin Heidelberg 1998Nested Datatypes 53 [4, [8,=-=[5]-=-,[[3]]], [[7],[],[[[7]]]], [[[],[[0]]]] ] This bush contains four entries, the first of which is an element of Int, the second an element of Bush Int, the third an element of Bush (Bush Int), and so o... |

13 |
A generalization of the trie data structure
- Connelly, Morris
- 1995
(Show Context)
Citation Context ...st, entries are “bushed”. For example, one value of type Bush Int is Johan Jeuring (Ed.): MPC’98, LNCS 1422, pp. 52–67, 1998. c○ Springer-Verlag Berlin Heidelberg 1998Nested Datatypes 53 [4, [8,[5],[=-=[3]-=-]], [[7],[],[[[7]]]], [[[],[[0]]]] ] This bush contains four entries, the first of which is an element of Int, the second an element of Bush Int, the third an element of Bush (Bush Int), and so on. In... |

11 | Catenable double-ended queues
- Okasaki
- 1997
(Show Context)
Citation Context ...ard Haskell. The upshot of the current situation is that nested datatypes have been rather neglected in functional programming. However, they are conceptually important and evidence is emerging (e.g. =-=[3,18,19]-=-) of their usefulness in functional data structure design. A brief illustration of what they can offer is given in Section 2. Regular datatypes, on the other hand, are the bread and butter of function... |

9 | Generic programming with relations and functors
- Bird, Hoogendijk, et al.
- 1993
(Show Context)
Citation Context ...A brief illustration of what they can offer is given in Section 2. Regular datatypes, on the other hand, are the bread and butter of functional programming. Recent work on polytypic programming (e.g. =-=[2,9,15]-=-) has systematised the mathematics of program construction with regular datatypes by focusing on a small number of generic operators, such as fold, thatcanbe defined for all such types. The basic idea... |

2 |
Explicit quantification
- Jones
(Show Context)
Citation Context ...e most recent versions of Hugs and GHC (the Glasgow Haskell Compiler) both support so-called rank-2 type signatures, in which one can universally quantify over type constructors as well as types (see =-=[20]-=-). By using such signatures one can construct most of the functions over nested datatypes that one wants. We will return to this point below. However, rank-2 type signatures are not yet part of standa... |

1 |
What is a datatype
- Moor, Hoogendijk
- 1996
(Show Context)
Citation Context ...ection proves more useful, then there is a need to give a systematic account of the method, not only for an arbitrary inductive nested datatype, but also for coinductive nested datatypes. Finally, in =-=[4]-=- (see also [5]) the idea was proposed that a datatype was a certain kind of functor called a relator, together with a membership relation. It needs to be seen how the notion of membership can be exten... |