Skip to main content Accessibility help

Unifying structured recursion schemes: An Extended Study

  • RALF HINZE (a1) and NICOLAS WU (a2)


Folds and unfolds have been understood as fundamental building blocks for total programming, and have been extended to form an entire zoo of specialised structured recursion schemes. A great number of these schemes were unified by the introduction of adjoint folds, but more exotic beasts such as recursion schemes from comonads proved to be elusive. In this paper, we show how the two canonical derivations of adjunctions from (co)monads yield recursion schemes of significant computational importance: monadic catamorphisms come from the Kleisli construction, and more astonishingly, the elusive recursion schemes from comonads come from the Eilenberg–Moore construction. Thus, we demonstrate that adjoint folds are more unifying than previously believed.



Hide All
Backhouse, R., Bijsterveld, M., van Geldrop, R. & van der Woude, J. (1995) Categorical fixed point calculus. In Category Theory and Computer Science: 6th International Conference, CTCS '95, Pitt, D., Rydeheard, D. E. & Johnstone, P. (eds), Lecture Notes in Computer Science, vol. 953. Berlin: Springer, pp. 159179.
Bartels, F. (2003) Generalised coinduction. Math. Struct. Comput. Sci. 13 (4), 321348.
Beck, J. (1969) Distributive laws. In Seminar on Triples and Categorical Homology Theory, Eckmann, B. (ed), Lecture Notes in Mathematics vol. 80. Berlin: Springer, pp. 119140.
Bird, R. & de Moor, O. (1997) Algebra of Programming. NJ: Prentice Hall.
Bird, R. & Paterson, R. (1999) Generalised folds for nested datatypes. Form. Asp. Comput. 11 (2), 200222.
Capretta, V., Uustalu, T. & Vene, V. (2006) Recursive coalgebras from comonads. Inform. Comput. 204 (4), 437468.
Climent, J. & Soliveres, J. (2010) Kleisli and Eilenberg-Moore constructions as parts of biadjoint situations. Extracta Math. 25 (1), 161.
Eilenberg, S. & Moore, J. C. (1965) Adjoint functors and triples. Illinois J. Math. 9 (3), 381398.
Fokkinga, M. (1990) Tupling and mutumorphisms. The Squiggolist 1 (4), 8182.
Fokkinga, M. (1992) Law and Order in Algorithmics. PhD thesis, the Netherlands: University of Twente.
Fokkinga, M. (1994) Monadic Maps and Folds for Arbitrary Datatypes. Memoranda Informatica 94-28. the Netherlands: Department of Computer Science, University of Twente.
Gibbons, J. (2000) Generic downwards accumulations. Sci. Comput. Program. 37 (1–3), 3765.
Hagino, T. (1987) Category Theoretic Approach to Data Types. PhD thesis, UK: University of Edinburgh.
Hinze, R. (2013) Adjoint folds and unfolds—an extended study. Sci. Comput. Program. 78 (11), 21082159.
Hinze, R. & James, D. W. (2011) Proving the unique fixed-point principle correct: An adventure with category theory. In Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming, ICFP '11. New York: ACM, pp. 359371.
Hinze, R. & Wu, N. (2011) Towards a categorical foundation for generic programming. In Proceedings of the 7th ACM SIGPLAN Workshop on Generic Programming, WGP '11. New York: ACM, pp. 4758.
Hinze, R. & Wu, N. (2013) Histo- and dynamorphisms revisited. In Proceedings of the 9th ACM SIGPLAN Workshop on Generic Programming, WGP '13. New York: ACM, pp. 112.
Hinze, R., Wu, N. & Gibbons, J. (2013) Unifying structured recursion schemes. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional Programming, ICFP '13. New York: ACM, pp. 209220.
Hinze, R., Wu, N. & Gibbons, J. (2015) Conjugate hylomorphisms – or: The mother of all structured recursion schemes. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL '15. New York: ACM, pp. 527538.
Huber, P. J. (1961) Homotopy theory in general categories. Math. Ann. 144 (5), 361385.
Kan, D. M. (1958) Adjoint functors. Trans. Am. Math. Soc. 87 (2), 294329.
Kleisli, H. (1965) Every standard construction is induced by a pair of adjoint functors. Proc. Am. Math. Soc. 16 (3), 544546.
Lambek, J. (1968) A fixpoint theorem for complete categories. Math. Z. 103 (2), 151161.
Mac Lane, S. (1998) Categories for the Working Mathematician. 2nd ed. Graduate Texts in Mathematics, vol. 5. Berlin: Springer.
Malcolm, G. (1990a) Algebraic Data Types and Program Transformation. PhD thesis, the Netherlands: University of Groningen.
Malcolm, G. (1990b) Data structures and program transformation. Sci. Comput. Program. 14 (2–3), 255280.
Matthes, R. & Uustalu, T. (2004) Substitution in non-wellfounded syntax with variable binding. Theor. Comput. Sci. 327 (1–2), 155174.
Meertens, L. (1992) Paramorphisms. Form. Asp. Comput. 4 (5), 413424.
Meijer, E., Fokkinga, M. & Paterson, R. (1991) Functional programming with bananas, lenses, envelopes and barbed wire. In Proceedings of the 5th ACM Conference on Functional Programming Languages and Computer Architecture, FPCA'91, Hughes, J. (ed), Lecture Notes in Computer Science, vol. 523. Berlin: Springer, pp. 124144.
Mendler, N. P. (1991) Inductive types and type constraints in the second-order lambda calculus. Ann. Pure Appl. Log. 51 (1–2), 159172.
Palmquist, P. H. (1971) The double category of adjoint squares. Reports of the Midwest Category Seminar V, Gray, J. (ed), Lecture Notes in Mathematics, vol. 195. Berlin: Springer, pp. 123153.
Pardo, A. (2002) Generic accumulations. In Generic Programming: IFIP TC2/WG2.1 Working Conference on Generic Programming, Gibbons, J. & Jeuring, J. (eds), International Federation for Information Processing, vol. 115. Dordrecht: Kluwer Academic Publishers, pp. 4978.
Turi, D. & Plotkin, G. (1997) Towards a mathematical operational semantics. In Proceedings of the 12th Annual IEEE Symposium on Logic in Computer Science, LICS '97. IEEE Computer Society Press, U.S., pp. 280291.
Uustalu, T. & Vene, V. (1999a) Mendler-style inductive types, categorically. Nord. J. Comput. 6 (3), 343361.
Uustalu, T. & Vene, V. (1999b) Primitive (co)recursion and course-of-value (co)iteration, categorically. Informatica 10 (1), 526.
Uustalu, T. & Vene, V. (2008) Comonadic notions of computation. Electron. Notes Theor. Comput. Sci. 203 (5), 263284.
Uustalu, T. & Vene, V. (2011) The recursion scheme from the cofree recursive comonad. Electron. Notes Theor. Comput. Sci. 229 (5), 135157.
Uustalu, T., Vene, V. & Pardo, A. (2001) Recursion schemes from comonads. Nord. J. Comput. 8 (3), 366390.
Vene, V. & Uustalu, T. (1998) Functional programming with apomorphisms (corecursion). Proc. Est. Acad. Sci.: Phys. Math. 47 (3), 147161.

Related content

Powered by UNSILO

Unifying structured recursion schemes: An Extended Study

  • RALF HINZE (a1) and NICOLAS WU (a2)


Full text views

Total number of HTML views: 0
Total number of PDF views: 0 *
Loading metrics...

Abstract views

Total abstract views: 0 *
Loading metrics...

* Views captured on Cambridge Core between <date>. This data will be updated every 24 hours.

Usage data cannot currently be displayed.

Unifying structured recursion schemes: An Extended Study

  • RALF HINZE (a1) and NICOLAS WU (a2)
Submit a response


No Discussions have been published for this article.


Reply to: Submit a response

Your details

Conflicting interests

Do you have any conflicting interests? *