Combining datatypes and effects

  • Authors:
  • Alberto Pardo

  • Affiliations:
  • Instituto de Computación, Universidad de la República, Montevideo, Uruguay

  • Venue:
  • AFP'04 Proceedings of the 5th international conference on Advanced Functional Programming
  • Year:
  • 2004

Quantified Score

Hi-index 0.00

Visualization

Abstract

Recursion schemes over datatypes constitute a powerful tool to structure functional programs. Standard schemes, like map and fold, have traditionally been studied in the context of purely-functional programs. In this paper we propose the generalization of well-known recursion schemes with the aim to obtain structuring mechanisms for programs with effects, assuming that effects are modelled by monads. We analyze the definition as well as the algebraic laws associated with the new recursion schemes. The way monads encapsulate effects plays an important role in the definition of the monadic recursion schemes, as it permits to focus on the structure of the recursive programs with effects disregarding the specific details of the effects involved. We illustrate the use of the recursion schemes and their laws with some traversal algorithms on graphs.