• Corpus ID: 15972097

Recursion Schemes from Comonads

  title={Recursion Schemes from Comonads},
  author={Tarmo Uustalu and Varmo Vene and Alberto Pardo},
  journal={Nord. J. Comput.},
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… 
The Recursion Scheme from the Cofree Recursive Comonad
Fantastic Morphisms and Where to Find Them: A Guide to Recursion Schemes
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
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.
Recursive Coalgebras from Comonads
Generalized Coinduction
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
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
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
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
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
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.


Primitive (Co)Recursion and Course-of-Value (Co)Iteration, Categorically
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
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.
Notions of Computation and Monads
  • E. Moggi
  • Computer Science
    Inf. Comput.
  • 1991
Fusion of recursive programs with computational effects
Monadic Maps and Folds for Arbitrary Datatypes
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
  • W. Wechler
  • Computer Science, Mathematics
    EATCS 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
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
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.