## Handlers of Algebraic Effects

### Cached

### Download Links

Citations: | 13 - 1 self |

### BibTeX

@MISC{Plotkin_handlersof,

author = {Gordon Plotkin and Matija Pretnar},

title = {Handlers of Algebraic Effects},

year = {}

}

### OpenURL

### Abstract

Abstract. We present an algebraic treatment of exception handlers and, more generally, introduce handlers for other computational effects representable by an algebraic theory. These include nondeterminism, interactive input/output, concurrency, state, time, and their combinations; in all cases the computation monad is the free-model monad of the theory. Each such handler corresponds to a model of the theory for the effects at hand. The handling construct, which applies a handler to a computation, is based on the one introduced by Benton and Kennedy, and is interpreted using the homomorphism induced by the universal property of the free model. This general construct can be used to describe previously unrelated concepts from both theory and practice. 1

### Citations

733 | Notions of Computation and Monads
- Moggi
- 1991
(Show Context)
Citation Context ... A on a set of generators A. The set UF A represents the set of computations that return values in A, and the monad UF corresponds [9] to the monad proposed by Moggi to model the corresponding effect =-=[2]-=-. The monad induced by the theory for exceptions in Example 1 maps a set X to X + E, the one for non-determinism in Example 2 maps it to the set F + (X) of finite non-empty subsets of X, while the one... |

493 | Algebraic laws for nondeterminism and concurrency - Hennessy, Milner - 1985 |

440 | Computational lambda-calculus and monads
- Moggi
- 1989
(Show Context)
Citation Context ... hop = op x(xi : αi.zi(xi))i, so that op is not handled. 4.1 Semantics For each assignment of models [X ] to type variables X, handler types χ are interpreted by models [[χ], given by [F σ ] = F [σ ] =-=[1]-=- = 1 [χ1 × χ2 ] = [χ1 ] × [χ2 ] [σ → χ] = [χ] [σ ] , where the model is given component-wise on M1 × M2 and point-wise on M A . Then, we interpret contexts Z = z1 : (α1) → χ1, . . . , zn : (αn) → χn b... |

268 | The essence of compiling with continuations
- Flanagan, Sabry, et al.
- 1993
(Show Context)
Citation Context ...llow a representation by operations and equations [4–6]; the operations give rise to the effects at hand. All of the effects mentioned above are algebraic, with the notable exception of continuations =-=[7]-=-, which have to be treated differently (see [8] for initial ideas). In the algebraic approach the arguments of an operation represent possible computations after an occurrence of an effect. For exampl... |

55 | Notions of computation determine monads
- Plotkin, Power
- 2002
(Show Context)
Citation Context ...ations of the theory, for example the ones stating that or is a semi-lattice operation, generate the free-model functor, which is exactly the monad proposed by Moggi to model the corresponding effect =-=[9]-=- (modulo the forgetful functor) and which is used to interpret the type F σ. The operations are then interpreted by the model structure. When viewed as a family of functions parametric in X, e.g., orX... |

55 | Representing layered monads - Filinski - 1999 |

52 | The Jakobshavns effect - Hughes - 1986 |

33 | Power.Algebraic Operations and Generic Effects
- Plotkin, John
- 2003
(Show Context)
Citation Context ...EPSRC grant GR/586371/01 and a Royal Society-Wolfson Award Fellowship. ⋆⋆ Supported by EPSRC grant GR/586371/01.algebraic operation; such families are characterised by a certain naturality condition =-=[5]-=-. Although this gives a way of constructing, combining [10], and reasoning [11] about algebraic effects, it does not account for their handling, as exception handlers, a well-known programming concept... |

30 | Adequacy for algebraic effects
- Plotkin, Power
- 2001
(Show Context)
Citation Context ...algebraic theory of effects. More routinely, perhaps, the work done on combinations of effects [10] should be extended to combinations of handlers; one would also like a general operational semantics =-=[4]-=- including Benton and Kennedy’s in [13]. The separation between the languages for handlers and computations is essential in the development of this paper. A possible alternative is to give a single la... |

26 | Computational effects and operations: an overview - Plotkin, Power - 2004 |

20 |
Exceptional syntax
- Benton, Kennedy
(Show Context)
Citation Context ...ined model of the algebraic theory; and it extends a programmer-defined map on values. The principal example is exception handling, particularly the exception-handling construct of Benton and Kennedy =-=[13]-=-, which our new construct generalises. It also includes many other, previously unrelated, concepts. For example, stream redirection of shell processes, renaming and hiding in CCS [14], timeout, and ro... |

10 | Discrete lawvere theories and computational effects
- Hyland, Power
- 2006
(Show Context)
Citation Context ...t to the set F + (X) of finite non-empty subsets of X, while the one for state in Example 3 maps it to (S ×X) S , where S = D L . One can give an equivalent treatment using countable Lawvere theories =-=[20]-=-. 4 Handlers Exception handlers are usually described and used within the same language: for each exception, we give a replacement computation term, which can contain further exception handlers. Repea... |

8 | Combining algebraic effects with continuations
- Hyland, Levy, et al.
(Show Context)
Citation Context ...ns [4–6]; the operations give rise to the effects at hand. All of the effects mentioned above are algebraic, with the notable exception of continuations [7], which have to be treated differently (see =-=[8]-=- for initial ideas). In the algebraic approach the arguments of an operation represent possible computations after an occurrence of an effect. For example, using a binary choice operation or:2, a nond... |

8 | Call-by-push-value: Decomposing call-by-value and call-by-name
- Levy
(Show Context)
Citation Context ...ing homomorphisms for the semantics of handlers via an informal discussion of exception handlers. In the following Sections 3, 4 and 5 we develop a formal calculus in the call-by-push-value framework =-=[15, 11]-=-. Section 3, describes (base) values and the algebraic theory of effects. A natural need for two languages arises: one to describe handlers, given in Section 4, and one where they are used to handle c... |

7 | Monads and adjunctions for global exceptions
- Levy
- 2006
(Show Context)
Citation Context ...sequences). Finally, we discuss some open questions and possible future work in Section 9. 2 Exception handlers We start our study with exception handlers both because they are an established concept =-=[13, 16]-=- and also because exceptions provide the simplest example of algebraic effects. To focus on the exposition of ideas, we write this section in a rather informal style, mixing syntax and semantics. Taki... |

6 |
A Mathematical Introduction to Logic 2nd edn
- Enderton
- 2001
(Show Context)
Citation Context ...bset [R] ⊆ [β ] for each relation symbol R: (β), where [[β ] = [β1 ] × . . . [βn ]. Terms Γ ⊢ v :β and formulas Γ ⊢ ϕ:form are interpreted by maps [[v ] : [Γ ] → [β ] and subsets [[ϕ] ⊆ [Γ ] as usual =-=[17]-=-. 3.2 Effect theory Standard equational logic does not give a finitary notation for describing effects given by an infinite family of operations, having an infinite number of outcomes, or described by... |

2 |
Universal algebra. 2nd edn
- Grätzer
- 1979
(Show Context)
Citation Context ..., lookup l(d:dat.update l ′ ,d(w)) represents the computation that copies d from l to l ′ and then proceeds as w. Each effect theory E gives rise to a standard (possibly infinitary) equational theory =-=[19]-=-. For each op:β; α1, . . . , αn ∈ Σeff and b ∈ [β ], we take an operation symbol opb of countable arity ∑ i |[αi ]|. Then each term Γ ; ∆ ⊢ T and each c ∈ [Γ ] give rise to a term ∆ ′ ⊢ Tc, where ∆ ′ ... |

1 |
Some varieties of equational logic. In: Essays Dedicated to
- Plotkin
- 2006
(Show Context)
Citation Context ...ssuming that Γ ; ∆ ⊢ T1, Γ ; ∆ ⊢ T2, and Γ ⊢ ϕ:form. Finally, a conditional effect theory E is a collection of such equations; it would be interesting to develop an equational logic for such theories =-=[18]-=-. Example 1. To describe a set E of exceptions, the base signature consists of a base type exc and a constant function symbol e : () → exc for each e ∈ E. We interpret exc by E and functional symbols ... |