Latent Effects for Reusable Language Components

Birthe van den Berg*, Tom Schrijvers, Casper Bach Poulsen, Nicolas Wu

*Corresponding author for this work

Research output: Chapter in Book/Conference proceedings/Edited volumeConference contributionScientificpeer-review

2 Citations (Scopus)


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.

Original languageEnglish
Title of host publicationProgramming Languages and Systems - 19th Asian Symposium, APLAS 2021, Proceedings
EditorsHakjoo Oh
PublisherSpringer Science+Business Media
Number of pages20
ISBN (Print)9783030890506
Publication statusPublished - 2021
Event19th Asian Symposium on Programming Languages and Systems, APLAS 2021 - Chicago, United States
Duration: 17 Oct 202118 Oct 2021

Publication series

NameLecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics)
Volume13008 LNCS
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349


Conference19th Asian Symposium on Programming Languages and Systems, APLAS 2021
Country/TerritoryUnited States


  • Effect handlers
  • Effects
  • Modularity
  • Monads
  • Staging


Dive into the research topics of 'Latent Effects for Reusable Language Components'. Together they form a unique fingerprint.

Cite this