Structured Handling of Scoped Effects: Extended Version
Zhixuan Yang, Marco Paviotti, Nicolas Wu, Birthe van den Berg, Tom, Schrijvers

TL;DR
This paper introduces a theoretically-founded, practical model for scoped effects in algebraic effects frameworks, enabling better handling, reasoning, and optimization of scoped operations.
Contribution
It presents a new model based on adjunctions that unifies existing approaches and facilitates implementation and reasoning about scoped effects.
Findings
The new model is as expressive as existing approaches for scoped effects.
It automatically induces fusion laws for handlers, aiding reasoning and optimization.
The model balances ease of implementation with structuredness.
Abstract
Algebraic effects offer a versatile framework that covers a wide variety of effects. However, the family of operations that delimit scopes are not algebraic and are usually modelled as handlers, thus preventing them from being used freely in conjunction with algebraic operations. Although proposals for scoped operations exist, they are either ad-hoc and unprincipled, or too inconvenient for practical programming. This paper provides the best of both worlds: a theoretically-founded model of scoped effects that is convenient for implementation and reasoning. Our new model is based on an adjunction between a locally finitely presentable category and a category of functorial algebras. Using comparison functors between adjunctions, we show that our new model, an existing indexed model, and a third approach that simulates scoped operations in terms of algebraic ones have equal expressivity…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Software Engineering Research · Advanced Software Engineering Methodologies
