Abstract
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.
- A. Bauer and M. Pretnar. Programming with algebraic effects and handlers, 2012.Google Scholar
- E. Brady. Programming and reasoning with algebraic effects and dependent types. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional programming, pages 133--144. ACM, 2013. Google Scholar
Digital Library
- R. Hinze. Deriving backtracking monad transformers. In Proceedings of the Fifth ACM SIGPLAN International Conference on Functional Programming, pages 186--197. ACM, 2000. ISBN 1-58113-202-6. Google Scholar
Digital Library
- M. Hyland, G. D. Plotkin, and J. Power. Combining effects: Sum and tensor. Theor. Comput. Sci., 357 (1--3): 70--99, 2006. Google Scholar
Digital Library
- M. Jaskelioff. Monatron: An extensible monad transformer library. In S.-B. Scholz and O. Chitil, editors, Implementation and Application of Functional Languages - Revised Selected Papers, volume 5836 of Lecture Notes in Computer Science, pages 233--248. Springer, 2008. Google Scholar
Digital Library
- M. Jaskelioff and E. Moggi. Monad transformers as monoid transformers. Theor. Comput. Sci., 411 (51--52): 4441--4466, Dec. 2010. Google Scholar
Digital Library
- O. Kammar, S. Lindley, and N. Oury. Handlers in action. In Proceedings of the 18th ACM SIGPLAN International Conference on Functional programming, pages 145--158. ACM, 2013. Google Scholar
Digital Library
- O. Kiselyov, A. Sabry, and C. Swords. Extensible effects: an alternative to monad transformers. In Proceedings of the 2013 ACM SIGPLAN symposium on Haskell, Haskell '13, pages 59--70. ACM, 2013. Google Scholar
Digital Library
- S. Liang, P. Hudak, and M. Jones. Monad transformers and modular interpreters. In POPL'95, 1995. Google Scholar
Digital Library
- kC. McBride. The Frank manual, May 2012. https://personal.cis.strath.ac.uk/conor.mcbride/pub/Frank/TFM.pdf.Google Scholar
- G. D. Plotkin and J. Power. Notions of computation determine monads. In M. Nielsen and U. Engberg, editors, Foundations of Software Science and Computation Structures, volume 2303 of Lecture Notes in Computer Science, pages 342--356. Springer, 2002. Google Scholar
Digital Library
- G. D. Plotkin and J. Power. Algebraic operations and generic effects. Applied Categorical Structures, 11 (1): 69--94, 2003.Google Scholar
Cross Ref
- G. D. Plotkin and M. Pretnar. Handlers of algebraic effects. In ESOP, volume 5502 of Lecture Notes in Computer Science, pages 80--94. Springer, 2009. Google Scholar
Digital Library
- W. Swierstra. Data types à la carte. J. Funct. Program., 18 (4): 423--436, 2008. Google Scholar
Digital Library
Index Terms
Effect handlers in scope
Recommendations
Liberating effects with rows and handlers
TyDe 2016: Proceedings of the 1st International Workshop on Type-Driven DevelopmentAlgebraic effects and effect handlers provide a modular abstraction for effectful programming. They support user-defined effects, as in Haskell, in conjunction with direct-style effectful programming, as in ML. They also present a structured interface ...
Effect handlers for the masses
Effect handlers are a program structuring paradigm with rising popularity in the functional programming language community and can express many advanced control flow abstractions. We present the first implementation of effect handlers for Java - an ...
Effect handlers in scope
Haskell '14: Proceedings of the 2014 ACM SIGPLAN symposium on HaskellAlgebraic 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 ...







Comments