Title
Compiling effect handlers in capability-passing style
Abstract
Effect handlers encourage programmers to abstract over repeated patterns of complex control flow. As of today, this abstraction comes at a significant price in performance. In this paper, we aim to achieve abstraction without regret for effect handlers. We present a language for effect handlers in _capability-passing style_ (λCap) and an implementation of this language as a translation to simply-typed lambda calculus in _iterated continuation-passing style_. A suite of benchmarks indicates that the novel combination of capability-passing style and iterated CPS enables significant speedups over existing languages with effect handlers or control operators. Our implementation technique is general and allows us to generate code in any language that supports first-class functions. We then identify a subset of programs for which we can further improve the performance and guarantee full elimination of the effect handler abstraction. To formally capture this subset, we refine λCap to λ λCap with a more restrictive type system. We present a type-directed translation for λ λCap that inserts staging annotations and prove that no abstractions or applications related to effect handlers occur in the translated program. Using this second translation we observe additional speedups in some of the benchmarks.
Year
DOI
Venue
2020
10.1145/3408975
Proceedings of the ACM on Programming Languages
Keywords
DocType
Volume
algebraic effects,capability-passing style,compilation,continuation-passing style,continuations,control effects,lexically-scoped effect handlers
Journal
4
Issue
ISSN
Citations 
ICFP
2475-1421
0
PageRank 
References 
Authors
0.34
0
3
Name
Order
Citations
PageRank
Philipp Schuster100.68
Jonathan Immanuel Brachthäuser273.18
Klaus Ostermann345723.97