Affiliation:
1. University of Wrocław, Poland
Abstract
Proposed originally by Plotkin and Pretnar, algebraic effects and their handlers are a leading-edge approach to computational effects: exceptions, mutable state, nondeterminism, and such. Appreciated for their elegance and expressiveness, they are now progressing into mainstream functional programming languages. In this paper, we introduce and examine programming language constructs that back adoption of programming with algebraic effects on a larger scale in a modular fashion by providing mechanisms for abstraction. We propose two such mechanisms: existential effects (which hide the details of a particular effect from the user) and local effects (which guarantee that no code coming from the outside can interfere with a given effect). The main technical difficulty arises from the dynamic nature of coupling an effectful operation with the right handler during execution, but, as we show in this paper, a carefully designed type system can ensure that this will not break the abstraction. Our main contribution is a novel calculus for algebraic effects and handlers, called λ
HEL
, equipped with local and existential algebraic effects, in which the dynamic nature of handlers is kept in check by typed runtime coercions. As a proof of concept, we present an experimental programming language based on our calculus, which provides strong abstraction mechanisms via an ML-style module system.
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Cited by
24 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Abstracting Effect Systems for Algebraic Effect Handlers;Proceedings of the ACM on Programming Languages;2024-08-15
2. On Model-Checking Higher-Order Effectful Programs;Proceedings of the ACM on Programming Languages;2024-01-05
3. Soundly Handling Linearity;Proceedings of the ACM on Programming Languages;2024-01-05
4. Verifying an Effect-Handler-Based Define-By-Run Reverse-Mode AD Library;Logical Methods in Computer Science;2023-10-23
5. A General Fine-Grained Reduction Theory for Effect Handlers;Proceedings of the ACM on Programming Languages;2023-08-30