Algebraic effects and handlers are a convenient method for structuring monadic effects with primitive effectful operations and separating the syntax from the interpretation of these operations. However, the scope of convential handlers are somewhat limited as not all side effects are monadic in nature. This paper generalizes the notion of algebraic effects and handlers from monads to generalized monoids, which notably covers applicative functors and arrows. For this purpose we switch the category theoretical basis from free algebras to free monoids. In addition, we show how lax monoidal functors enable the reuse of handlers and programs across different computation classes, for example handling applicative computations with monadic handlers.
@inproceedings{ifl2017post,
title = {Handlers for Non-Monadic Computations},
author = {Ruben Pieters and Tom Schrijvers and Exequiel Rivas},
year = {2018},
booktitle = {Proceedings of the 29th Symposium on the Implementation and Application of Functional Programming Languages},
series = {IFL '17},
url = {/Research/papers/ifl2017_post.pdf},
abstract = {Algebraic effects and handlers are a convenient method for structuring monadic
effects with primitive effectful operations and separating the syntax from the
interpretation of these operations. However, the scope of convential handlers
are somewhat limited as not all side effects are monadic in nature. This paper
generalizes the notion of algebraic effects and handlers from monads to
generalized monoids, which notably covers applicative functors and arrows. For
this purpose we switch the category theoretical basis from free algebras to
free monoids. In addition, we show how lax monoidal functors enable the reuse
of handlers and programs across different computation classes, for example
handling applicative computations with monadic handlers.
},
}