Recursive monadic bindings

  • Authors:
  • Levent Erkök;John Launchbury

  • Affiliations:
  • Oregon Graduate Institute of Science and Technology;Oregon Graduate Institute of Science and Technology

  • Venue:
  • ICFP '00 Proceedings of the fifth ACM SIGPLAN international conference on Functional programming
  • Year:
  • 2000

Quantified Score

Hi-index 0.00

Visualization

Abstract

Monads have become a popular tool for dealing with computational effects in Haskell for two significant reasons: equational reasoning is retained even in the presence of effects; and program modularity is enhanced by hiding "plumbing" issues inside the monadic infrastructure. Unfortunately, not all the facilities provided by the underlying language are readily available for monadic computations. In particular, while recursive monadic computations can be defined directly using Haskell's built-in recursion capabilities, there is no natural way to express recursion over the values of monadic actions. Using examples, we illustrate why this is a problem, and we propose an extension to Haskell's donotation to remedy the situation. It turns out that the structure of monadic value-recursion depends on the structure of the underlying monad. We propose an axiomatization of the recursion operation and provide a catalogue of definitions that satisfy our criteria.