Abstract
Abstract
As popularity of algebraic effects and handlers increases, so does a demand for their efficient execution. Eff, an ML-like language with native support for handlers, has a subtyping-based effect system on which an effect-aware optimising compiler could be built. Unfortunately, in our experience, implementing optimisations for Eff is overly error-prone because its core language is implicitly typed, making code transformations very fragile. To remedy this, we present an explicitly typed polymorphic core calculus for algebraic effect handlers with a subtyping-based type-and-effect system. It reifies appeals to subtyping in explicit casts with coercions that witness the subtyping proof, quickly exposing typing bugs in program transformations. Our typing-directed elaboration comes with a constraint-based inference algorithm that turns an implicitly typed Eff-like language into our calculus. Moreover, all coercions and effect information can be erased in a straightforward way, demonstrating that coercions have no computational content. Additionally, we present a monadic translation from our calculus into a pure language without algebraic effects or handlers, using the effect information to introduce monadic constructs only where necessary.
Publisher
Cambridge University Press (CUP)
Reference41 articles.
1. Once upon a polymorphic type
2. Type Inference with Structural Subtyping: A Faithful Formalization of an Efficient Constraint Solver
3. Type checking with open type functions
4. Towards a theory of type structure
5. Pretnar, M. , Saleh, A. H. , Faes, A. & Schrijvers, T. (2017) Efficient Compilation of Algebraic Effects and Handlers. Technical report. CW 708. KU Leuven Department of Computer Science.
Cited by
4 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Soundly Handling Linearity;Proceedings of the ACM on Programming Languages;2024-01-05
2. Sound and Complete Type Inference for Closed Effect Rows;Lecture Notes in Computer Science;2022
3. Efficient compilation of algebraic effect handlers;Proceedings of the ACM on Programming Languages;2021-10-20
4. Contextual modal types for algebraic effects and handlers;Proceedings of the ACM on Programming Languages;2021-08-22