Reference. Continuation Passing Style for Effect Handlers
We present Continuation Passing Style (CPS) translations for Plotkin and Pretnar’s effect handlers with Hillerström and Lindley’s row-typed fine-grain call-by-value calculus of effect handlers as the source language. CPS translations of handlers are interesting theoretically, to explain the semantics of handlers, and also offer a practical implementation technique that does not require special support in the target language’s runtime.
We begin with a first-order CPS translation into untyped lambda calculus which manages a stack of continuations and handlers as a curried sequence of arguments. We then refine the initial CPS translation first by uncurrying it to yield a properly tail-recursive translation and second by making it higher-order in order to contract administrative redexes at translation time. We prove that the higher-order CPS translation simulates effect handler reduction. We have implemented the higher-order CPS translation as a JavaScript backend for the Links programming language.
Cite
Cited by (2)
Effect handlers via generalised continuations hillerstrom-2020-effect
On the expressive power of user-defined effects: Effect handlers, monadic reflection, delimited control forster-2019-on
Cites 27 works (2 here)
With notes (2)
Do be do be do lindley-2017-do
Handlers in action kammar-2013-handlers
External (25)
- On the expressive power of user-defined effects: Effect handlers, monadic reflection, delimited control (2017)
- Type directed compilation of row-typed algebraic effects (2017)
- Liberating effects with rows and handlers (2016)
- Eff directly in OCaml (2016)
- Programming with algebraic effects and handlers (2015)
- Effective concurrency through algebraic effects (2015)
- Freer monads, more extensible effects (2015)
- An introduction to algebraic effects and handlers (2015)
- Programming and reasoning with algebraic effects and dependent types (2013)
- Handling algebraic effects (2013)
- Row-based effect types for database integration (2012)
- A dynamic interpretation of the CPS hierarchy (2012)
- Subtyping delimited continuations (2011)
- Compiling with continuations, continued (2007)
- Links: Web programming without tiers (2006)
- A first-order one-pass CPS transformation (2003)
- Modelling environments in call-by-value programming languages (2003)
- Adequacy for algebraic effects (2001)
- A calculus of tagged types, with applications to process languages (1995)
- The essence of compiling with continuations (1993)
- Syntactic theories and the algebra of record terms (1993)
- Compiling with Continuations (1992)
- The essence of functional programming (1992)
- Notions of computation and monads (1991)
- Call-by-name, call-by-value and the lambda-calculus (1975)