TY - GEN
T1 - Latent Effects for Reusable Language Components
AU - van den Berg, Birthe
AU - Schrijvers, Tom
AU - Poulsen, Casper Bach
AU - Wu, Nicolas
PY - 2021
Y1 - 2021
N2 - The development of programming languages can be quite complicated and costly. Hence, much effort has been devoted to the modular definition of language features that can be reused in various combinations to define new languages and experiment with their semantics. A notable outcome of these efforts is the algebra-based “datatypes à la carte” (DTC) approach. When combined with algebraic effects, DTC can model a wide range of common language features. Unfortunately, the current state of the art does not cover modular definitions of advanced control-flow mechanisms that defer execution to an appropriate point, such as call-by-name and call-by-need evaluation, as well as (multi-)staging. This paper defines latent effects, a generic class of such control-flow mechanisms. We demonstrate how function abstractions, lazy computations and a MetaML-like staging can all be expressed in a modular fashion using latent effects, and how they can be combined in various ways to obtain complex semantics. We provide a full Haskell implementation of our effects and handlers with a range of examples.
AB - The development of programming languages can be quite complicated and costly. Hence, much effort has been devoted to the modular definition of language features that can be reused in various combinations to define new languages and experiment with their semantics. A notable outcome of these efforts is the algebra-based “datatypes à la carte” (DTC) approach. When combined with algebraic effects, DTC can model a wide range of common language features. Unfortunately, the current state of the art does not cover modular definitions of advanced control-flow mechanisms that defer execution to an appropriate point, such as call-by-name and call-by-need evaluation, as well as (multi-)staging. This paper defines latent effects, a generic class of such control-flow mechanisms. We demonstrate how function abstractions, lazy computations and a MetaML-like staging can all be expressed in a modular fashion using latent effects, and how they can be combined in various ways to obtain complex semantics. We provide a full Haskell implementation of our effects and handlers with a range of examples.
KW - Effect handlers
KW - Effects
KW - Modularity
KW - Monads
KW - Staging
UR - http://www.scopus.com/inward/record.url?scp=85118165855&partnerID=8YFLogxK
U2 - 10.1007/978-3-030-89051-3_11
DO - 10.1007/978-3-030-89051-3_11
M3 - Conference contribution
AN - SCOPUS:85118165855
SN - 9783030890506
VL - 13008
T3 - Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
SP - 182
EP - 201
BT - Programming Languages and Systems - 19th Asian Symposium, APLAS 2021, Proceedings
A2 - Oh, Hakjoo
PB - Springer Science+Business Media
T2 - 19th Asian Symposium on Programming Languages and Systems, APLAS 2021
Y2 - 17 October 2021 through 18 October 2021
ER -