## Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire (1991)

Citations: | 302 - 11 self |

### BibTeX

@INPROCEEDINGS{Meijer91functionalprogramming,

author = {Erik Meijer and Maarten Fokkinga and Ross Paterson},

title = {Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire},

booktitle = {},

year = {1991},

pages = {124--144},

publisher = {Springer-Verlag}

}

### Years of Citing Articles

### OpenURL

### Abstract

We develop a calculus for lazy functional programming based on recursion operators associated with data type definitions. For these operators we derive various algebraic laws that are useful in deriving and manipulating programs. We shall show that all example functions in Bird and Wadler's "Introduction to Functional Programming" can be expressed using these operators. 1 Introduction Among the many styles and methodologies for the construction of computer programs the Squiggol style in our opinion deserves attention from the functional programming community. The overall goal of Squiggol is to calculate programs from their specification in the way a mathematician calculates solutions to differential equations, or uses arithmetic to solve numerical problems. It is not hard to state, prove and use laws for well-known operations such as addition, multiplication and ---at the function level--- composition. It is, however, quite hard to state, prove and use laws for arbitrarily recursively ...

### Citations

1312 | Constructive functional programming
- Bird
- 1989
(Show Context)
Citation Context ...ly associated with algebraic type definitions. A number of general theorems are proven about these operators and subsequently used to transform programs and prove their correctness. Bird and Meertens =-=[4, 18]-=- have identified several laws for specific data types (most notably finite lists) using which they calculated solutions to various programming problems. By embedding the calculus into a categorical fr... |

473 |
Denotational Semantics: the Scott-Strachey approach to programming Language Theory
- Stoy
- 1985
(Show Context)
Citation Context ...cursive functions. The first one is a `free theorem' for the fixed point operators2 (A ! A) ! A f (g) = h ( f strictsf ffi g = h ffi f (16) Theorem (16) appears under different names in many places 2 =-=[20, 8, 2, 15, 7, 25, 13, 31]-=-. In this paper it will be called fixed point fusion. The strictness condition in (16) can sometimes be relaxed by using f (g) = f 0 (g 0 ) ( f ? = f 0 ?sf ffi g = h ffi fsf 0 ffi g 0 = h ffi f 0 (17)... |

458 | Comprehending Monads
- Wadler
- 1990
(Show Context)
Citation Context ...nads Any free type gives rise to a monad [17], in the above notation, (; tau 2 I \Delta ! ; join= 2 \Delta ! ) since: join= ffi tau = id join= ffi tau = id join= ffi join= = join= ffi join= 23 Wadler =-=[29]-=- gives a thorough discussion on the concepts of monads and their use in functional programming. 6 Conclusion We have considered various patterns of recursive definitions, and have presented a lot of l... |

364 |
Types, abstraction and parametric polymorphism
- Reynolds
- 1983
(Show Context)
Citation Context ...: ' B ffi fF = fG ffi 'A (11) As a convenient shorthand for (11) we use ' 2 F \Delta ! G to denote that ' is a natural transformation. The "Theorems For Free!" theorem of Wadler, deBruin and=-= Reynolds [28, 9, 22]-=- states that any function definable in the polymorphic -calculus is a natural transformation. If ' is defined using , one can only conclude that (11) holds for strict f. Recursive types After all this... |

330 | Theorems for free
- Wadler
- 1989
(Show Context)
Citation Context ...: ' B ffi fF = fG ffi 'A (11) As a convenient shorthand for (11) we use ' 2 F \Delta ! G to denote that ' is a natural transformation. The "Theorems For Free!" theorem of Wadler, deBruin and=-= Reynolds [28, 9, 22]-=- states that any function definable in the polymorphic -calculus is a natural transformation. If ' is defined using , one can only conclude that (11) holds for strict f. Recursive types After all this... |

259 |
Semantic Domains and Denotational Semantics. In
- Scott, Gunther
- 1990
(Show Context)
Citation Context ...cursive functions. The first one is a `free theorem' for the fixed point operators2 (A ! A) ! A f (g) = h ( f strictsf ffi g = h ffi f (16) Theorem (16) appears under different names in many places 2 =-=[20, 8, 2, 15, 7, 25, 13, 31]-=-. In this paper it will be called fixed point fusion. The strictness condition in (16) can sometimes be relaxed by using f (g) = f 0 (g 0 ) ( f ? = f 0 ?sf ffi g = h ffi fsf 0 ffi g 0 = h ffi f 0 (17)... |

217 |
An introduction to the theory of lists
- Bird
- 1987
(Show Context)
Citation Context ...ut them. For calculating large programs one certainly needs high level algorithmic theorems. The work reported here provides the necessary tools to develop such theorems. For the theory of lists Bird =-=[3]-=- has started to do so, and with success. Another aspect of program calculation is machine assistance. Our experience ---including that of our colleagues--- shows that the size of formal manipulations ... |

169 |
The category-theoretic solution of recursive domain equations
- Smyth, Plotkin
- 1982
(Show Context)
Citation Context ...introduced in x5. Then there exists a type L and two strict functions in F 2 LF ! L and out F 2 L ! LF (omitting subscripts whenever possible) which are each others inverse and even id = (in F / out) =-=[6, 23, 16, 24, 30, 12]. We let F-=- denote the pair (L; in) and say that it is "the least fixed point of F". Since in and out are each others inverses we have that LF is isomorphic to L, and indeed L is --- upto isomorphism -... |

142 | Views: a way for pattern matching to cohabit with data abstraction
- Wadler
(Show Context)
Citation Context ...it is not inductively defined on the data type num ::= 0 j 1 +num. There is however no `simple' ' such that fac = (j'j). The problem with the factorial is that it "eats its argument and keeps it =-=too" [27]-=-, the brute force catamorphic solution would therefore have fac 0 return a pair (n; n!) to be able to compute (n + 1)!. Paramorphisms were investigated by Meertens [19] to cover this pattern of primit... |

96 |
Algorithmics: Towards programming as a mathematical activity
- Meertens
- 1986
(Show Context)
Citation Context ...ly associated with algebraic type definitions. A number of general theorems are proven about these operators and subsequently used to transform programs and prove their correctness. Bird and Meertens =-=[4, 18]-=- have identified several laws for specific data types (most notably finite lists) using which they calculated solutions to various programming problems. By embedding the calculus into a categorical fr... |

37 |
Algebraic Specification of Data Types: A Synthetic Approach
- Lehmann, Smyth
- 1981
(Show Context)
Citation Context ...introduced in x5. Then there exists a type L and two strict functions in F 2 LF ! L and out F 2 L ! LF (omitting subscripts whenever possible) which are each others inverse and even id = (in F / out) =-=[6, 23, 16, 24, 30, 12]. We let F-=- denote the pair (L; in) and say that it is "the least fixed point of F". Since in and out are each others inverses we have that LF is isomorphic to L, and indeed L is --- upto isomorphism -... |

33 |
Denotational Semantics
- Schmidt
- 1986
(Show Context)
Citation Context ...introduced in x5. Then there exists a type L and two strict functions in F 2 LF ! L and out F 2 L ! LF (omitting subscripts whenever possible) which are each others inverse and even id = (in F / out) =-=[6, 23, 16, 24, 30, 12]. We let F-=- denote the pair (L; in) and say that it is "the least fixed point of F". Since in and out are each others inverses we have that LF is isomorphic to L, and indeed L is --- upto isomorphism -... |

16 |
Tupling and mutumorphisms
- Fokkinga
- 1990
(Show Context)
Citation Context ... conclude that sum ffi squares = (jNil 5 ((+) ffi SQkid)j). A slightly more complicated problem is to derive a one-pass solution for average = DIV ffi sum 4 length Using the tupling lemma of Fokkinga =-=[10]-=- (j'j) L 4 (j/j) L = (j(' ffi ` L) 4 (/ ffi ' L)j) a simple calculation shows that average = DIV ffi (j(0 ffl 5 (+) ffi idk` ) 4 (0 ffl 5 (+1) ffi ' j). Accumulating Arguments An important item in the... |

7 |
Programming Calculi Based on Fixed Point Transformations
- Meyer
- 1985
(Show Context)
Citation Context ...cursive functions. The first one is a `free theorem' for the fixed point operators2 (A ! A) ! A f (g) = h ( f strictsf ffi g = h ffi f (16) Theorem (16) appears under different names in many places 2 =-=[20, 8, 2, 15, 7, 25, 13, 31]-=-. In this paper it will be called fixed point fusion. The strictness condition in (16) can sometimes be relaxed by using f (g) = f 0 (g 0 ) ( f ? = f 0 ?sf ffi g = h ffi fsf 0 ffi g 0 = h ffi f 0 (17)... |

5 |
Naturalness of polymorphism
- Bruin
- 1989
(Show Context)
Citation Context ...: ' B ffi fF = fG ffi 'A (11) As a convenient shorthand for (11) we use ' 2 F \Delta ! G to denote that ' is a natural transformation. The "Theorems For Free!" theorem of Wadler, deBruin and=-= Reynolds [28, 9, 22]-=- states that any function definable in the polymorphic -calculus is a natural transformation. If ' is defined using , one can only conclude that (11) holds for strict f. Recursive types After all this... |

5 |
Codatatypes in ML
- Hagino
- 1989
(Show Context)
Citation Context ...type is an !-cpo and we consider only continuous functions between types (categorically, we are working in the category CPO). Working in the category SET as done by for example Malcolm [17] or Hagino =-=[14]-=- means that finite data types (defined as initial algebras) and infinite data types (defined as final co-algebras) constitute two different worlds. In that case it is not possible to define functions ... |

4 |
Translating attribute grammars into catamorphisms
- Fokkinga, Jeuring, et al.
- 1991
(Show Context)
Citation Context ...+ bs = (jid ffl 5 \Phij) as bs where a \Phi f bs = Cons (a; f bs). In general catamorphisms of higher type L ! (I ! S) form an interesting class by themselves as they correspond to attribute grammars =-=[11]-=-. Anamorphisms Evaluation rule The evaluation rule for anamorphisms is given by: out ffi db(/)ec = db(/)ecL ffi / (AnaEval) 15 It says what the result of an arbitrary application of db(/)ec looks like... |

4 |
Programmierung mit funktionsobjecten: Konstruktive erzeugung semantlsche berelche und anwendung auf die partielle auswertung
- Zierer
- 1988
(Show Context)
Citation Context |

3 |
Fixed point constructions in order enriched categories
- Wand
- 1979
(Show Context)
Citation Context |

2 |
A relational theory of types
- Backhouse, Woude, et al.
- 1991
(Show Context)
Citation Context ...oblems. By embedding the calculus into a categorical framework, Bird and Meertens' work on lists can be extended to arbitrary, inductively defined data types [17, 12]. Recently the group of Backhouse =-=[1]-=- has extended the calculus to a relational framework, thus covering indeterminancy. Independently, Paterson [21] has developed a calculus of functional programs similar in contents but very dissimilar... |

2 |
An introduction to the category-theoretic solution of recursive domain equations
- Bos, Hemerik
- 1988
(Show Context)
Citation Context |

2 | Retractions in Comparing Prolog Semantics
- Bruin, Vink
- 1989
(Show Context)
Citation Context |

2 |
Algebraic Types and Program Transformation
- Malcolm
- 1990
(Show Context)
Citation Context ...ulated solutions to various programming problems. By embedding the calculus into a categorical framework, Bird and Meertens' work on lists can be extended to arbitrary, inductively defined data types =-=[17, 12]-=-. Recently the group of Backhouse [1] has extended the calculus to a relational framework, thus covering indeterminancy. Independently, Paterson [21] has developed a calculus of functional programs si... |

2 |
Reasoning about Functional Programs
- Paterson
- 1988
(Show Context)
Citation Context ...d to arbitrary, inductively defined data types [17, 12]. Recently the group of Backhouse [1] has extended the calculus to a relational framework, thus covering indeterminancy. Independently, Paterson =-=[21]-=- has developed a calculus of functional programs similar in contents but very dissimilar in appearance (like many Australian animals) to the work referred to above. Actually if one pricks through the ... |

2 |
factorlsation and promotion
- Homomorphisms
- 1990
(Show Context)
Citation Context ...et f = db(f y id ffi out)ec. From the UP for catas we find that this conforms to the usual definition of map. f ffi Nil = Nil f ffi Cons = Cons ffi fkf Other important laws for maps are factorization =-=[26]-=- and promotion [4]. (j'j) ffi f = (j' ffi (fy)j) (34) f ffi db(/)ec = db((fy) ffi /)ec (35) (j'j) ffi f = g ffi (jj) ( g ffis= ' ffi f y gsg strict (36) f ffi db(/)ec = db()ec ffi g (sffi g = f y g ff... |

1 |
On the use of composition in transformational programming
- Berghammer
- 1985
(Show Context)
Citation Context |

1 |
Transformation parallel ablaufender Programme
- Broy
- 1980
(Show Context)
Citation Context |

1 |
Some techniques for recursion removal
- Arsac, Kodratoff
- 1982
(Show Context)
Citation Context |