Reasoning about effect interaction by fusion
Open Access
- 19 August 2021
- journal article
- research article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Programming Languages
- Vol. 5 (ICFP) , 1-29
Abstract
Effect handlers can be composed by applying them sequentially, each handling some operations and leaving other operations uninterpreted in the syntax tree. However, the semantics of composed handlers can be subtle---it is well known that different orders of composing handlers can lead to drastically different semantics. Determining the correct order of composition is a non-trivial task. To alleviate this problem, this paper presents a systematic way of deriving sufficient conditions on handlers for their composite to correctly handle combinations, such as the sum and the tensor, of the effect theories separately handled. These conditions are solely characterised by the clauses for relevant operations of the handlers, and are derived by fusing two handlers into one using a form of fold/build fusion and continuation-passing style transformation. As case studies, the technique is applied to commutative and distributive interaction of handlers to obtain a series of results about the interaction of common handlers: (a) equations respected by each handler are preserved after handler composition; (b) handling mutable state before any handler gives rise to a semantics in which state operations are commutative with any operations from the latter handler; (c) handling the writer effect and mutable state in either order gives rise to a correct handler of the commutative combination of these two theories.Keywords
Funding Information
- Engineering and Physical Sciences Research Council (EP/S028129/1)
This publication has 43 references indexed in Scilit:
- Theory and Practice of Fusion2011
- Program Calculation in Coq2011
- Handlers of Algebraic Effects2009
- Asymptotic Improvement of Computations over Free MonadsLecture Notes in Computer Science, 2008
- Combining effects: Sum and tensorTheoretical Computer Science, 2006
- Computational Effects and Operations: An OverviewElectronic Notes in Theoretical Computer Science, 2004
- Axioms for Probability and NondeterminismElectronic Notes in Theoretical Computer Science, 2004
- Notions of Computation Determine Monads2002
- Notions of computation and monadsInformation and Computation, 1991
- A Couple of Novelties in the Propositional CalculusMathematical Logic Quarterly, 1985