Hostname: page-component-7b7567c8c-7pwfn Total loading time: 0 Render date: 2026-11-15T02:33:46.401Z Has data issue: false hasContentIssue false

On the expressive power of user-defined effects: Effect handlers, monadic reflection, delimited control

Published online by Cambridge University Press:  08 October 2019

YANNICK FORSTER
Affiliation:
Department of Computer Science, Saarland University, GermanyComputer Laboratory, University of Cambridge, England (e-mail: forster@ps.uni-saarland.de)
OHAD KAMMAR
Affiliation:
School of Informatics, The University of Edinburgh, ScotlandDepartment of Computer Science, Balliol College, University of OxfordComputer Laboratory, University of Cambridge, England (e-mail: ohad.kammar@ed.ac.uk)
SAM LINDLEY
Affiliation:
School of Informatics, The University of Edinburgh, ScotlandDepartment of Computing, Imperial College, London, England (e-mail: sam.lindley@ed.ac.uk)
MATIJA PRETNAR
Affiliation:
Faculty of Mathematics and Physics, University of Ljubljana, Slovenia (e-mail: matija.pretnar@fmf.uni-lj.si)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the 'Save PDF' action button.

We compare the expressive power of three programming abstractions for user-defined computational effects: Plotkin and Pretnar’s effect handlers, Filinski’s monadic reflection, and delimited control. This comparison allows a precise discussion about the relative expressiveness of each programming abstraction. It also demonstrates the sensitivity of the relative expressiveness of user-defined effects to seemingly orthogonal language features. We present three calculi, one per abstraction, extending Levy’s call-by-push-value. For each calculus, we present syntax, operational semantics, a natural type-and-effect system, and, for effect handlers and monadic reflection, a set-theoretic denotational semantics. We establish their basic metatheoretic properties: safety, termination, and, where applicable, soundness and adequacy. Using Felleisen’s notion of a macro translation, we show that these abstractions can macro express each other, and show which translations preserve typeability. We use the adequate finitary set-theoretic denotational semantics for the monadic calculus to show that effect handlers cannot be macro expressed while preserving typeability either by monadic reflection or by delimited control. Our argument fails with simple changes to the type system such as polymorphism and inductive types. We supplement our development with a mechanised Abella formalisation.

Information

Type
Regular Paper
Copyright
© Cambridge University Press 2019 
Submit a response

Discussions

No Discussions have been published for this article.