Title
Extensible effects: an alternative to monad transformers
Abstract
We design and implement a library that solves the long-standing problem of combining effects without imposing restrictions on their interactions (such as static ordering). Effects arise from interactions between a client and an effect handler (interpreter); interactions may vary throughout the program and dynamically adapt to execution conditions. Existing code that relies on monad transformers may be used with our library with minor changes, gaining efficiency over long monad stacks. In addition, our library has greater expressiveness, allowing for practical idioms that are inefficient, cumbersome, or outright impossible with monad transformers. Our alternative to a monad transformer stack is a single monad, for the coroutine-like communication of a client with its handler. Its type reflects possible requests, i.e., possible effects of a computation. To support arbitrary effects and their combinations, requests are values of an extensible union type, which allows adding and, notably, subtracting summands. Extending and, upon handling, shrinking of the union of possible requests is reflected in its type, yielding a type-and-effect system for Haskell. The library is lightweight, generalizing the extensible exception handling to other effects and accurately tracking them in types.
Year
DOI
Venue
2013
10.1145/2503778.2503791
Haskell
Keywords
Field
DocType
coroutine-like communication,possible request,effect handler,monad transformer,extensible exception,extensible effect,extensible union type,possible effect,single monad,long monad stack,arbitrary effect,coroutine,monad
Coroutine,Programming language,Computer science,Generalization,Exception handling,Haskell,Monad transformer,Extensibility,Monad (functional programming),Computation
Conference
Volume
Issue
ISSN
48
12
0362-1340
Citations 
PageRank 
References 
34
1.22
16
Authors
3
Name
Order
Citations
PageRank
Oleg Kiselyov166045.44
Amr Sabry252035.46
Cameron Swords3422.42