# Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire

@inproceedings{Meijer1991FunctionalPW, title={Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire}, author={Erik Meijer and Maarten M. Fokkinga and Ross A. Paterson}, booktitle={FPCA}, year={1991} }

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.

## Topics from this paper

## 677 Citations

FUNCTIONAL PROGRAMMING WITH APOMORPHISMS (CORECURSION)

- Computer Science
- 2010

This work draws attention to the dual notion of apomorphisms — functions with coinductive target types defined by primitive corecursion and shows on examples that primitivecorecursion is useful in programming.

Sliced bananas on opaque data ? The expression lemma

- 2008

Algebraic data types and catamorphisms (folds) play a central role in functional programming as they allow programmers to define recursive data structures and operations on them uniformly by…

The Expression Lemma

- Computer ScienceMPC
- 2008

A coalgebraic model of OO programming with functional objects is assumed and the development may be helpful in deriving refactorings that turn sufficiently disciplined functional programs into OO programs of a designated shape and vice versa.

Down with variables

- Computer Science
- 2005

This paper presents a mechanism that allows programmers to convert classic point-wise code into point-free style, and a Haskell library that enables the direct execution of the resulting code.

Polytipic recursion patterns

- Mathematics
- 2000

Recursive schemes over inductive data structures have been recognized as categorytheoretic universals, yielding a handful of equational laws for program construction and transformation. This paper…

Handling Recursion in Generic Programming Using Closed Type Families

- 2018

Many of the extensively used libraries for datatype-generic programming offer a fixed-point view on datatypes to express their recursive structure. However, some other approaches, especially the ones…

Chapter 25 Reasoning About Effects : Seeing the Wood Through the Trees

- 2008

Pure functional languages support programming with impure effects by exploiting mathematical notions such as monads, applicative functors, and arrows. However, in contrast to the wealth of research…

Polytypic Recursion Patterns

- 2005

Recursive schemes over inductive data structures have been recognized as categorytheoretic universals, yielding a handful of equational laws for program construction and transformation. This paper…

Polytypic Recursion

- 2000

Recursive schemes over inductive data structures have been recognized as category-theoretic universals, yielding a handful of equational laws for program construction and transformation. This paper…

Shortcut deforestation in calculational form

- Computer ScienceFPCA '95
- 1995

This work presents a simple algorithm for deforestation based on two fusion rules for hylomorphismj an expressive recursion pattern, and a generic notation for hyLomorphisms is introduced, where natural transformations are explicitly factored out, and it is used to represent programs.

## References

SHOWING 1-10 OF 52 REFERENCES

Introduction to functional programming

- Computer SciencePrentice Hall International series in computer science
- 1988

This is a thorough introduction to the fundamental concepts of functional programming that includes a simple, yet coherent treatment of the Haskell class; a calculus of time complexity; and new coverage of monadic input-output.

An introduction to the theory of lists

- Computer Science
- 1987

In these lectures a notation and a calculus for specifying and manipulating computable functions over lists are introduced, used to derive efficient solutions for a number of problems, including problems in text processing.

Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory

- Computer Science
- 1981

Treats various kinds of languages, beginning with the pure-lambda-calculus and progressing through languages with states, commands, jumps, and assignments.

Comprehending monads

- Computer ScienceLISP and Functional Programming
- 1990

It is shown how list comprehensions may be generalised to an arbitrary monad, and how the resulting programming feature can concisely express in a pure functional language some programs that manipulate state, handle exceptions, parse text, or invoke continuations.

Retractions in comparing Prolog semantics

- Computer Science
- 1990

An operational model O and a continuation based denotational model D for a uniform variant of PROLOG, including the cut operator are proved equivalent in a novel way by comparing yet another pair of higher order transformations Phi~ and Psi~, that yield Phi and PSI, respectively, by application of a suitable abstraction operator.

Theorems for free!

- Computer ScienceFPCA
- 1989

From the type of a polymorphic function the authors can derive a theorem that it satisfies, courtesy of Reynolds’ abstraction theorem for the polymorphic lambda calculus, which provides a free source of useful theorems.

Codatatypes in ML

- Computer Science, MathematicsJ. Symb. Comput.
- 1989

A new data type declaration mechanism of defining codatatypes is introduced to a functional programming language ML, giving ML the missing half of data types and makes ML symmetric.

Some Techniques for Recursion Removal from Recursive Functions

- Computer ScienceTOPL
- 1982

This method uses generalization to transform a recursive definition into an equivalent tail-recursive one in a systematic way which can be automated, and proves the validity of the recursive-to-iterative transformation, even when the recursive definition is not everywhere defined.

Program Calculation Properties of Continuous Algebras

- Mathematics
- 1991

Defining data types as initial algebras, or dually as final co-algebras, is beneficial, if not indispensible, for an algebraic calculus for program construction, in view of the nice equational…

Algorithmics : towards programming as a mathematical activity

- Computer Science
- 1986

The essence of the method is to start with an obviously correct—but possibly hopelessly inefficient—algorithm, and to improve by successively applying correctness-preserving transformations, akin to those used in mathematics.