Abstract
Folds over inductive datatypes are well understood and widely used. In their plain form, they are quite restricted; but many disparate generalisations have been proposed that enjoy similar calculational benefits. There have also been attempts to unify the various generalisations: two prominent such unifications are the 'recursion schemes from comonads' of Uustalu, Vene and Pardo, and our own 'adjoint folds'. Until now, these two unified schemes have appeared incompatible. We show that this appearance is illusory: in fact, adjoint folds subsume recursion schemes from comonads. 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.
- R. Backhouse, M. Bijsterveld, R. van Geldrop, and J. van der Woude, "Categorical fixed point calculus," in CTCS, ser. LNCS, vol. 953. Springer, 1995, pp. 159--179. Google Scholar
Digital Library
- F. Bartels, "Generalised coinduction," Mathematical Structures in Computer Science, vol. 13, pp. 321--348, 2003. Google Scholar
Digital Library
- R. Bird and O. de Moor, Algebra of Programming. London: Prentice Hall, 1997. Google Scholar
Digital Library
- R. Bird and R. Paterson, "Generalised folds for nested datatypes," Formal Aspects of Computing, vol. 11, no. 2, pp. 200--222, 1999.Google Scholar
Digital Library
- V. Capretta, T. Uustalu, and V. Vene, "Recursive coalgebras from comonads," Information and Computation, vol. 204, no. 4, pp. 437--468, 2006. Google Scholar
Digital Library
- S. Eilenberg and J. C. Moore, "Adjoint functors and triples," Illinois J. Math, vol. 9, no. 3, pp. 381--398, 1965.Google Scholar
Cross Ref
- M. M. Fokkinga, "Law and order in algorithmics," Ph.D. dissertation, University of Twente, Feb. 1992.Google Scholar
- ----, "Tupling and mutumorphisms," The Squiggolist, vol. 1, no. 4, pp. 81--82, Jun. 1990.Google Scholar
- J. Gibbons, "Generic downwards accumulations," Science of Computer Programming, vol. 37, no. 1--3, pp. 37--65, 2000. Google Scholar
Digital Library
- T. Hagino, "Category theoretic approach to data types," Ph.D. dissertation, University of Edinburgh, 1987.Google Scholar
- R. Hinze, "Adjoint folds and unfolds--an extended study," Science of Computer Programming, Aug. 2012. Google Scholar
Digital Library
- R. Hinze and D. W. James, "Proving the unique fixed-point principle correct: an adventure with category theory," in ICFP. ACM, 2011, pp. 359--371. Google Scholar
Digital Library
- P. J. Huber, "Homotopy theory in general categories," Math. Ann., vol. 144, pp. 361--385, 1961.Google Scholar
Cross Ref
- D. M. Kan, "Adjoint functors," Trans. AMS, vol. 87, no. 2, pp. 294--329, 1958.Google Scholar
Cross Ref
- H. Kleisli, "Every standard construction is induced by a pair of adjoint functors," Proc. AMS, vol. 16, no. 3, pp. 544--546, Jun. 1965.Google Scholar
- J. Lambek, "A fixpoint theorem for complete categories," Math. Zeitschr., vol. 103, pp. 151--161, 1968.Google Scholar
Cross Ref
- S. Mac Lane, Categories for the Working Mathematician, 2nd ed., ser. Graduate Texts in Mathematics. Berlin: Springer-Verlag, 1998.Google Scholar
- G. Malcolm, "Algebraic data types and program transformation," Ph.D. dissertation, University of Groningen, 1990.Google Scholar
- ----, "Data structures and program transformation," Science of Computer Programming, vol. 14, no. 2-3, pp. 255--280, 1990. Google Scholar
Digital Library
- R. Matthes and T. Uustalu, "Substitution in non-wellfounded syntax with variable binding," TCS, vol. 327, no. 1-2, pp. 155--174, 2004. Google Scholar
Digital Library
- L. Meertens, "Paramorphisms," Formal Aspects of Computing, vol. 4, pp. 413--424, 1992.Google Scholar
Digital Library
- E. Meijer, M. Fokkinga, and R. Paterson, "Functional programming with bananas, lenses, envelopes and barbed wire," in FPLCA, ser. LNCS, vol. 523. Springer, 1991, pp. 124--144. Google Scholar
Digital Library
- N. P. Mendler, "Inductive types and type constraints in the second-order lambda calculus," Ann. Pure Appl. Logic, vol. 51, no. 1-2, pp. 159--172, 1991.Google Scholar
Cross Ref
- P. H. Palmquist, "The double category of adjoint squares," in Midwest Category Seminar V, ser. LNM. Springer, 1971, vol. 195, pp. 123--153.Google Scholar
- A. Pardo, "Generic accumulations," in Working Conference on Generic Programming, vol. 243. Kluwer Academic Publishers, Jul. 2002, pp. 49--78. Google Scholar
Digital Library
- T. Uustalu and V. Vene, "Primitive (co)recursion and course-of-value (co)iteration, categorically," Informatica, Lith. Acad. Sci., vol. 10, no. 1, pp. 5--26, 1999.Google Scholar
- ----, "Comonadic notions of computation," in CMCS, ser. ENTCS, vol. 203(5), 2008, pp. 263--284. Google Scholar
Digital Library
- ----, "Mendler-style inductive types, categorically," Nordic J. Comput., vol. 6, pp. 343--361, 1999. Google Scholar
Digital Library
- ----, "The recursion scheme from the cofree recursive comonad," ENTCS, vol. 229, no. 5, pp. 135--157, 2011, proceedings of the Second Workshop on Mathematically Structured Functional Programming (MSFP 2008). Google Scholar
Digital Library
- T. Uustalu, V. Vene, and A. Pardo, "Recursion schemes from comonads," Nordic J. Comput., vol. 8, pp. 366--390, Sep. 2001. Google Scholar
Digital Library
- V. Vene and T. Uustalu, "Functional programming with apomorphisms (corecursion)," Proceedings of the Estonian Academy of Sciences: Physics, Mathematics, vol. 47, no. 3, pp. 147--161, 1998.Google Scholar
Cross Ref
- J. C. Vidal and J. S. Tur, "Kleisli and Eilenberg-Moore constructions as parts of biadjoint situations," Extracta Mathematicae, vol. 25, no. 1, pp. 1--61, 2010.Google Scholar
Index Terms
Unifying structured recursion schemes
Recommendations
Unifying structured recursion schemes
ICFP '13: Proceedings of the 18th ACM SIGPLAN international conference on Functional programmingFolds over inductive datatypes are well understood and widely used. In their plain form, they are quite restricted; but many disparate generalisations have been proposed that enjoy similar calculational benefits. There have also been attempts to unify ...
Recursion schemes from comonads
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 ...
Recursive coalgebras from comonads
Special issue: Seventh workshop on coalgebraic methods in computer science 2004The concept of recursive coalgebra of a functor was introduced in the 1970s by Osius in his work on categorical set theory to discuss the relationship between wellfounded induction and recursively specified functions. In this paper, we motivate the use ...







Comments