Lune

OOPSLA2022Top-tier venue

First-class names for effect handlers

Ningning Xie, Youyou Cong, Kazuki Ikemori, Daan Leijen

Abstract

Algebraic effects and handlers are a promising technique for incorporating composable computational effects into functional programming languages. Effect handlers enable concisely programming with different effects, but they do not offer a convenient way to program with different instances of the same effect. As a solution to this inconvenience, previous studies have introduced named effect handlers, which allow the programmer to distinguish among different effect instances. However, existing formalizations of named handlers are both involved and restrictive, as they employ non-standard mechanisms to prevent the escaping of handler names. In this paper, we propose a simple and flexible design of named handlers. Specifically, we treat handler names as first-class values, and prevent their escaping while staying within the ordinary λ-calculus. Such a design is enabled by combining named handlers with scoped effects, a novel variation of effects that maintain a scope via rank-2 polymorphism. We formalize two combinations of named handlers and scoped effects, and implement them in the Koka programming language. We also present practical applications of named handlers, including a neural network and a unification algorithm.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

8 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Lexical Effect Handlers, Directly cites Continuing WebAssembly with Effect Handlers
  • Lexical Effect Handlers, Directly cites Effects as capabilities: effect handlers and lightweight effect polymorphism
  • Lexical Effect Handlers, Directly cites Binders by day, labels by night: effect instances via lexically scoped handlers
  • Modal Effect Types cites Continuing WebAssembly with Effect Handlers
  • Modal Effect Types cites Effects as capabilities: effect handlers and lightweight effect polymorphism
  • Modal Effect Types cites Soundly Handling Linearity
  • Modal Effect Types cites Binders by day, labels by night: effect instances via lexically scoped handlers
  • Zero-Overhead Lexical Effect Handlers cites Lexical Effect Handlers, Directly
  • Zero-Overhead Lexical Effect Handlers cites Continuing WebAssembly with Effect Handlers
  • Zero-Overhead Lexical Effect Handlers cites Effects as capabilities: effect handlers and lightweight effect polymorphism
  • Zero-Overhead Lexical Effect Handlers cites Binders by day, labels by night: effect instances via lexically scoped handlers
  • Effects as capabilities: effect handlers and lightweight effect polymorphism cites Binders by day, labels by night: effect instances via lexically scoped handlers
  • Soundly Handling Linearity cites Continuing WebAssembly with Effect Handlers
  • Soundly Handling Linearity cites Effects as capabilities: effect handlers and lightweight effect polymorphism
  • Soundly Handling Linearity cites Binders by day, labels by night: effect instances via lexically scoped handlers
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers8

  1. Continuing WebAssembly with Effect HandlersLuna Phipps-Costin, Andreas Rossberg, Arjun Guha, Daan Leijen et al.OOPSLA 2023 · 20 citations
  2. Soundly Handling LinearityWenhao Tang, Daniel Hillerström, Sam Lindley, J. Garrett MorrisPOPL 2024 · 8 citations
  3. Lexical Effect Handlers, DirectlyCong Ma, Zhaoyi Ge, Edward Lee, Yizhou ZhangOOPSLA 2024 · 7 citations
  4. Modal Effect TypesWenhao Tang, Leo White, Stephen Dolan, Daniel Hillerström et al.OOPSLA 2025 · 4 citations
  5. Zero-Overhead Lexical Effect HandlersCong Ma, Zhaoyi Ge, Max Jung, Yizhou ZhangOOPSLA 2025 · 2 citations

Builds on3

  1. Effects as capabilities: effect handlers and lightweight effect polymorphismJonathan Immanuel Brachthäuser, Philipp Schuster, Klaus OstermannOOPSLA 2020 · 62 citations
  2. Binders by day, labels by night: effect instances via lexically scoped handlersDariusz Biernacki, Maciej Piróg, Piotr Polesiuk, Filip SieczkowskiPOPL 2020 · 46 citations
  3. Perceus: garbage free reference counting with reuseAlex Reinking, Ningning Xie, Leonardo de Moura, Daan LeijenPLDI 2021 · 31 citations

Related papers

  1. Hefty Algebras: Modular Elaboration of Higher-Order Algebraic EffectsCasper Bach Poulsen, Cas van der RestPOPL 2023 · 9 citations
  2. Dynamic Wind for Effect HandlersDavid Voigt, Philipp Schuster, Jonathan Immanuel BrachthäuserOOPSLA 2025
  3. Tracing Just-in-Time Compilation for Effects and HandlersMarcial Gaißert, Carl Friedrich Bolz-Tereick, Jonathan Immanuel BrachthäuserOOPSLA 2025
  4. Efficient compilation of algebraic effect handlersGeorgios Karachalias, Filip Koprivec, Matija Pretnar, Tom SchrijversOOPSLA 2021 · 9 citations
  5. Rows and Capabilities as Modal EffectsWenhao Tang, Sam LindleyPOPL 2026 · 1 citation
Dusk over the sea between two cliffs drawn in fine vertical lines