Published January 28, 2022 | Version v1
Conference paper Open

Structured Handling of Scoped Effects

  • 1. Imperial College London
  • 2. KU Leuven

Description

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 for handling scoped operations. We consider our new model to be the sweet spot between ease of implementation and structuredness. Additionally, our approach automatically induces fusion laws of handlers of scoped effects, which are useful for reasoning and optimisation.

Files

Artifact.txt

Files (901.1 MB)

Name Size Download all
md5:84e3d6e402879a3815b47d4a3476ed5f
221 Bytes Preview Download
md5:45ddb71e1b099bc1a67882518e275220
425 Bytes Download
md5:caae91bb619b53993e431063e76ada9f
21.4 kB Download
md5:ac0c81ce95c4b5b6c73881a7d5795d24
11.9 kB Download
md5:476d991918a4afb87a0423416cfd0b6b
486.3 kB Preview Download
md5:09ce578b9cfcf1bc5f3daeee787f8f7d
7.7 kB Preview Download
md5:2792ee0165a4ffed8508c103448d8529
900.6 MB Download

Additional details

Funding

SCOPE: Scoped Contextual Operations and Effects. EP/S028129/1
UK Research and Innovation