Affiliation:
1. Saarland University, Germany / University of Cambridge, UK
2. University of Oxford, UK / University of Cambridge, UK
3. University of Edinburgh, UK
4. University of Ljubljana, Slovenia
Abstract
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 without answer-type-modification. 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.
Funder
Engineering and Physical Sciences Research Council
Air Force Office of Scientific Research
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Cited by
26 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Parallel Algebraic Effect Handlers;Proceedings of the ACM on Programming Languages;2024-08-15
2. Abstracting Effect Systems for Algebraic Effect Handlers;Proceedings of the ACM on Programming Languages;2024-08-15
3. An Intrinsically Typed Compiler for Algebraic Effect Handlers;Proceedings of the 2024 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation;2024-01-11
4. Answer Refinement Modification: Refinement Type System for Algebraic Effects and Handlers;Proceedings of the ACM on Programming Languages;2024-01-05
5. Towards a Reflection for Effect Handlers;Proceedings of the 2023 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation;2023-01-15