Abstract
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 conventional handlers is 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 as well as monads. 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. We motivate and present these handler interfaces in the context of build systems. Tasks in a build system are represented by a free computation and their interpretation as a handler. This use case is based on the work of Mokhov et al. [(2018). PACMPL2(ICFP), 79:1–79:29.].
Publisher
Cambridge University Press (CUP)
Reference29 articles.
1. Comprehending monads
2. Rivas, E. , Jaskelioff, M. & Schrijvers, T. (2015) From monoids to nearsemirings: The essence of MonadPlus and Alternative. In Proceedings of the 17th International Symposium on Principles and Practice of Declarative Programming. PPDP 2015, Falaschi, M. & Albert, E. (eds). ACM, pp. 196–207.
3. Notions of computation as monoids
4. Handlers of Algebraic Effects
5. Handlers for Non-Monadic Computations
Cited by
3 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Modular Models of Monoids with Operations;Proceedings of the ACM on Programming Languages;2023-08-30
2. Introducing ⦇ λ ⦈, a λ-calculus for effectful computation;Theoretical Computer Science;2021-05
3. Compiling symbolic execution with staging and algebraic effects;Proceedings of the ACM on Programming Languages;2020-11-13