Effect handlers in scope

N Wu, T Schrijvers, R Hinze - Proceedings of the 2014 ACM SIGPLAN …, 2014 - dl.acm.org
Proceedings of the 2014 ACM SIGPLAN Symposium on Haskell, 2014dl.acm.org
Algebraic effect handlers are a powerful means for describing effectful computations. They
provide a lightweight and orthogonal technique to define and compose the syntax and
semantics of different effects. The semantics is captured by handlers, which are functions
that transform syntax trees. Unfortunately, the approach does not support syntax for scoping
constructs, which arise in a number of scenarios. While handlers can be used to provide a
limited form of scope, we demonstrate that this approach constrains the possible interactions …
Algebraic effect handlers are a powerful means for describing effectful computations. They provide a lightweight and orthogonal technique to define and compose the syntax and semantics of different effects. The semantics is captured by handlers, which are functions that transform syntax trees.
Unfortunately, the approach does not support syntax for scoping constructs, which arise in a number of scenarios. While handlers can be used to provide a limited form of scope, we demonstrate that this approach constrains the possible interactions of effects and rules out some desired semantics.
This paper presents two different ways to capture scoped constructs in syntax, and shows how to achieve different semantics by reordering handlers. The first approach expresses scopes using the existing algebraic handlers framework, but has some limitations. The problem is fully solved in the second approach where we introduce higher-order syntax.
ACM Digital Library