Generalized monoidal effects and handlers

Autor: Ruben P. Pieters, Tom Schrijvers, Exequiel Rivas
Přispěvatelé: Catholic University of Leuven - Katholieke Universiteit Leuven (KU Leuven), Programming securely with cryptography (PROSECCO), Inria de Paris, Institut National de Recherche en Informatique et en Automatique (Inria)-Institut National de Recherche en Informatique et en Automatique (Inria), Programming securely with cryptography (PROSECCO )
Rok vydání: 2020
Předmět:
Zdroj: Journal of Functional Programming
Journal of Functional Programming, 2020, 30, ⟨10.1017/S0956796820000106⟩
Journal of Functional Programming, Cambridge University Press (CUP), 2020, 30, ⟨10.1017/S0956796820000106⟩
ISSN: 1469-7653
0956-7968
DOI: 10.1017/s0956796820000106
Popis: 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.].
Databáze: OpenAIRE