# Recursion Schemes from Comonads

@article{Uustalu2001RecursionSF, title={Recursion Schemes from Comonads}, author={Tarmo Uustalu and Varmo Vene and Alberto Pardo}, journal={Nord. J. Comput.}, year={2001}, volume={8}, pages={366-390} }

Within the setting of the categorical approach to total functional programming, we introduce a "many-in-one" recursion scheme that neatly unifies a variety of seemingly diverging strengthenings of the basic recursion scheme of iteration. The new scheme is doubly generic: in addition to being parametric in a functor capturing the signature of an inductive type, it is also parametric in a comonad and a distributive law (of the functor over the comonad) that together encode the recursive call…

## 60 Citations

The Recursion Scheme from the Cofree Recursive Comonad

- MathematicsElectron. Notes Theor. Comput. Sci.
- 2011

Fantastic Morphisms and Where to Find Them: A Guide to Recursion Schemes

- Computer ScienceArXiv
- 2022

This expository paper introduces structured recursion schemes from a practical point of view: a variety of recursions are motivated and explained in contexts of concrete programming examples, and the categorical duals of these recursion scheme are explained.

Conjugate Hylomorphisms -- Or: The Mother of All Structured Recursion Schemes

- Mathematics, Computer SciencePOPL 2015
- 2014

A simple toolbox for assembling recursive coalgebras, which by definition ensure that their hylo equations have unique solutions, whatever the algebra, is developed and it is shown that many basic adjunctions induce useful recursion schemes.

Generalized Coinduction

- Mathematics, Computer Science
- 2002

The approach gives a unifying categorical presentation and justification of several extensions of the basic coinduction schemata that have been treated separately before, some only for specific types of systems.

Unifying structured recursion schemes

- Computer ScienceICFP 2013
- 2013

It is shown that adjoint folds subsume recursion schemes from comonads and the proof of this claim involves standard constructions in category theory that are nevertheless not well known in functional programming: Eilenberg-Moore categories and bialgebras.

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.

Objects Versus Abstract Data Types : Bialgebraically

- Computer Science
- 2008

There is a duality between these two approaches which is formalised using a distributive law and defined a notion of behavioural equivalence of the dual functional and objectoriented programs.

CIA Structures and the Semantics of Recursion

- Mathematics, Computer ScienceFoSSaCS
- 2010

This work formalizes recursive function definitions involving operations given by λ as recursive program schemes for λ, and proves that unique solutions exist in the extended cias and presents a uniform account of the semantics of recursive definitions in final coalgebras.

Recursion Patterns as Hylomorphisms

- Computer Science, Mathematics
- 2003

This paper defines the accumulation recursion pattern introduced by Pardo using a hylomorphism, and uses this definition to derive the strictness conditions that characterize this operator in the presence of partiality.

## References

SHOWING 1-10 OF 26 REFERENCES

Primitive (Co)Recursion and Course-of-Value (Co)Iteration, Categorically

- MathematicsInformatica
- 1999

It is shown on ex-amples that primitive corecursion is a useful function definition scheme and two novel constructions, viz., histomorphisms and futumorphisms, that capture the powerful schemes of course-of-value iteration and its dual are argued.

Towards Merging Recursion and Comonads

- Computer Science
- 2000

Two applications are shown that naturally lead to versions of a comonadic fold operator on the product comonad that capture functions that require extra arguments for their computation and are related with the notion of strong datatype.

Distributivity for endofunctors, pointed and co-pointed endofunctors, monads and comonads

- MathematicsCMCS
- 2000

From Set-theoretic Coinduction to Coalgebraic Coinduction: some results, some problems

- MathematicsCMCS
- 1999

Monadic Maps and Folds for Arbitrary Datatypes

- Mathematics
- 1994

Each datatype constructor comes equiped not only with a so-called map and fold ( catamorphism ), as is widely known, but, under some condition, also with a kind of map and fold that are related to an…

Universal Algebra for Computer Scientists

- Computer Science, MathematicsEATCS Monographs on Theoretical Computer Science
- 1992

This volume offers a new model-theoretic approach to universal algebra and presents a systematic development of the methods of results of universal algebra that are useful in a variety of applications in computer science.

Merging Monads and Folds for Functional Programming

- Computer ScienceAdvanced Functional Programming
- 1995

The simultaneous use of generalised fold operators and monads to structure functional programs and how generalised monadic folds aid in calculating an efficient graph reduction engine from an inefficient specification is discussed.

The essence of functional programming

- Computer SciencePOPL '92
- 1992

This paper explores the use monads to structure functional programs and describes the relation between monads and the continuation-passing style in a compiler for Haskell that is written in Haskell.