Abstract:
Fold and unfold are general purpose functionals for processing and constructing lists. By using the categorical approach of modelling recursive datatypes as fixed points of functors, these functionals and their algebraic properties were generalised from lists to polynomial (sum-of-product) datatypes. However, the restriction to polynomial datatypes is a serious limitation: it precludes the use of exponentials (functionspaces) , whereas it is central to functional programming that functions are first-class values, and so exponentials should be able to be used freely in datatype definitions. In this paper we explain how Freyd's work on modelling recursive datatypes as fixed points of difunctors shows how to generalise fold and unfold from polynomial datatypes to those involving exponentials. Knowledge of category theory is not required; we use Gofer throughout as our meta-language, making extensive use of constructor classes. 1 Introduction During the 1980s, Bird and Meertens [6, 22] d...
Citations
|
1122
|
Introduction to Functional Programming
– Bird, Wadler
- 1988
|
|
870
|
The Lambda Calculus. Its Syntax and Semantics
– Barendregt
- 1984
|
|
341
|
Deforestation: transforming programs to eliminate trees
– Wadler
- 1990
|
|
278
|
Types, abstraction and parametric polymorphism
– Reynolds
- 1983
|
|
270
|
Denotational semantics: A Methodology for Language Development
– Schmidt
- 1986
|
|
250
|
Functional programming with bananas, lenses, envelopes and barbed wire
– Meijer, Fokkinga, et al.
- 1991
|
|
224
|
Theorems for free
– Wadler
- 1989
|
|
197
|
The lazy lambda calculus
– Abramsky
- 1977
|
|
162
|
A system of constructor classes: overloading and implicit higher-order polymorphism
– Jones
- 1995
|
|
104
|
A Fold for All Seasons
– Sheard, Fegaras
- 1993
|
|
89
|
and Order in Algorithmics
– Law
- 1992
|
|
89
|
Algorithmics -- towards programming as a mathematical activity
– Meertens
- 1987
|
|
87
|
Higher-order functions for parsing
– Hutton
- 1992
|
|
85
|
Algebraically complete categories
– Freyd
- 1990
|
|
73
|
Algebraic Data Types and Program Transformation
– Malcolm
- 1990
|
|
73
|
Algebraic Approaches to Program Semantics
– Manes, Arbib
- 1986
|
|
71
|
and Oege de Moor. Algebra of Programming
– Bird
- 1997
|
|
62
|
Recursive types reduced to inductive types
– Freyd
- 1990
|
|
39
|
Calculating Compilers
– Meijer
- 1992
|
|
39
|
On the relation between direct and continuation semantics
– Reynolds
- 1974
|
|
29
|
Category Theoretic Approach to Data Types
– Hagino
- 1987
|
|
28
|
The category theoretic solution of recursive domain equations
– Smyth, Plotkin
- 1982
|
|
22
|
der Woude, A relational theory of datatypes
– Aarts, Backhouse, et al.
- 1992
|
|
22
|
Algebras for Tree Algorithms
– Gibbons
- 1991
|
|
15
|
Relational properties of recursively defined domains
– Pitts
- 1993
|
|
12
|
More advice on proving a compiler correct: Improve a correct compiler
– Meijer
- 1994
|
|
5
|
Programming Languages and their Definition, volume 177 of LNCS
– Bekic
- 1984
|
|
5
|
Modelling office processes with functional parsers
– Florijn
- 1994
|
|
5
|
Gofer goes bananas
– Meijer, Jones
- 1994
|
|
4
|
Gofer 2.28 release notes
– Jones
- 1993
|
|
3
|
Control structures from types
– Paterson
- 1994
|
|
2
|
Type classes for better free theorems
– Meijer
- 1994
|
|
1
|
Gofer 2.28 release notes. February
– Jones
- 1993
|