## A Flexible Semantic Framework for Effects

### Cached

### Download Links

### BibTeX

@MISC{Tate_aflexible,

author = {Ross Tate and Daan Leijen and Sorin Lerner},

title = {A Flexible Semantic Framework for Effects},

year = {}

}

### OpenURL

### Abstract

Effects are a powerful and convenient component of programming. They enable programmers to interact with the user, take advantage of efficient stateful memory, throw exceptions, and nondeterministically execute programs in parallel. However, they also complicate every aspect of reasoning about a program or language, and as a result it is crucially important to have a good understanding of what effects are and how they work. In this paper we present a new framework for formalizing the semantics of effects that is more general and thorough than previous techniques while clarifying many of the important concepts. By returning to the categorytheoretic roots of monads, our framework is rich enough to describe the semantics of effects for a large class of languages including common imperative and functional languages. It is also capable of capturing more expressive, precise, and practical effect systems than previous approaches. Finally, our framework enables one to reason about effects in a language-independent manner, and so can be applied to many stages of language design and implementation in order to create more broadly applicable tools for programming languages. 1.

### Citations

1354 | Introduction to Functional Programming
- Bird
- 1998
(Show Context)
Citation Context ...upposedly pure languages such as Haskell use implicit non-termination, and Haskell even provides a means for users to define and use their own effects via monads and imperative functional programming =-=[9]-=-. Other languages such as in parsing tools use implicit enumerable non-determinism so that programmers may specify search problems in a concise manner. Since effects are so integral to programming lan... |

766 | Notions of computation and monads
- Moggi
- 1991
(Show Context)
Citation Context ...aws for imperative functional programming [9]. Our framework is both more general and more thorough than the predominant techniques for formalizing the semantics of effects, namely monadic techniques =-=[2, 9, 17, 18, 26]-=-. As evidence of our framework’s generality, in this paper we provide two effect systems whose semantics our framework can formalize but which cannot be formalized using monadic techniques, contrary t... |

467 | Comprehending monads
- Wadler
- 1990
(Show Context)
Citation Context ...nt effects is only containment of effects. In fact, monadic techniques for building effect systems handle interaction of two different effects by combining their monads into one monad containing both =-=[7, 11, 14, 16]-=-. On the other hand, the bounded nondeterminism system is not sequentially compressive, and the state machine system is not increasing, so they can define more interesting interactions, such as that f... |

457 | Computational Lambda-calculus and monads
- Moggi
- 1988
(Show Context)
Citation Context ...laws for imperative functional programming [9]. Our framework is both more general and more thorough than the predominant technique for formalizing the semantics of effects, namely monadic techniques =-=[2, 9, 18, 19, 25]-=-. As evidence of our framework’s generality, in this paper we provide two effect systems whose semantics our framework can formalize but which cannot be formalized using monadic techniques, contrary t... |

251 | Polymorphic effect systems
- Lucassen, Gifford
- 1988
(Show Context)
Citation Context ... that effects play in languages, some of which have not been addressed before. For each role we present both a nominal component for naming effects (this is the space in which type-andeffect analyses =-=[15, 17, 22, 23, 24]-=- work) and a semantic component for defining the denotational semantics of effects (this is the space in which monadic techniques typically work). Our framework is also general, making only the assump... |

248 | Monad transformers and modular interpreters
- Liang, Hudak, et al.
- 1995
(Show Context)
Citation Context ...nt effects is only containment of effects. In fact, monadic techniques for building effect systems handle interaction of two different effects by combining their monads into one monad containing both =-=[7, 11, 14, 16]-=-. On the other hand, the bounded nondeterminism system is not sequentially compressive, and the state machine system is not increasing, so they can define more interesting interactions, such as that f... |

173 |
Topologie Algébrique et Théorie des Faisceaus
- Godement
- 1958
(Show Context)
Citation Context ... present sequential semantic effect systems which are a generalization of monads, the predominant technique for formalizing the semantics of effects. In 1958, Godement invented standard constructions =-=[4]-=-, which became known as (Kleisli) triples, which became known as monads. In 1988, Moggi migrated the concept of monads from the category theory community to the programming languages semantics communi... |

171 |
Sketches of an elephant: a topos theory compendium
- Johnstone
- 2002
(Show Context)
Citation Context ... that the category of computations satisfies a couniversal property with respect to the effect system. This theorem is straightforward to prove so we do not do so here. Theorem. KE is the lax colimit =-=[6, 21]-=- of the lax functorE. In particular, the Kleisli category of a monad is the lax colimit of its corresponding lax functor. Thus the above theorem simply indicates that our generalization of monads pres... |

159 | The type and effect discipline
- Talpin, Jouvelot
- 1994
(Show Context)
Citation Context ... that effects play in languages, some of which have not been addressed before. For each role we present both a nominal component for naming effects (this is the space in which type-andeffect analyses =-=[15, 17, 22, 23, 24]-=- work) and a semantic component for defining the denotational semantics of effects (this is the space in which monadic techniques typically work). Our framework is also general, making only the assump... |

125 | Polymorphic type, region and effect inference
- Talpin, Jouvelot
- 1992
(Show Context)
Citation Context ... that effects play in languages, some of which have not been addressed before. For each role we present both a nominal component for naming effects (this is the space in which type-andeffect analyses =-=[15, 17, 22, 23, 24]-=- work) and a semantic component for defining the denotational semantics of effects (this is the space in which monadic techniques typically work). Our framework is also general, making only the assump... |

103 | The marriage of effects and monads
- Wadler
- 1998
(Show Context)
Citation Context ...not be formalized using monadic techniques, contrary to the claim made by Wadler and Thiemann that the semantics of any effect system can be formalized using a hierarchy of monads and monad morphisms =-=[27]-=-. Our framework is more general because it emphasizes the interaction of effects whereas monadic techniques typically treat each effect individually. Using our framework, we are able to classify and p... |

98 | Simple imperative polymorphism
- Wright
- 1995
(Show Context)
Citation Context ... we apply our framework to three problems across the spectrum of language design and implementation, providing language-independent solutions to each problem. First we show that the value restriction =-=[28]-=- can be relaxed in the presence of effects satisfying an abstract property phrased in terms of our framework. Second we define abstract properties of effects in the presence of which common-subexpress... |

75 |
Higher Operads, Higher Categories
- Leinster
(Show Context)
Citation Context ...ertable sequentially compressive effects satisfies the equality requirements of semantic effect systems if and only if it forms what is known as a colax map of monads in the category theory community =-=[13]-=- or a monad morphism in the functional languages community [2, 18, 25]. This fact, combined with the above lemma, entails the following corollary. Corollary. The denotational semantics of a sequential... |

72 | Composing Monads
- Jones, Duponcheel
- 1993
(Show Context)
Citation Context ...nt effects is only containment of effects. In fact, monadic techniques for building effect systems handle interaction of two different effects by combining their monads into one monad containing both =-=[7, 11, 14, 16]-=-. On the other hand, the bounded nondeterminism system is not sequentially compressive, and the state machine system is not increasing, so they can define more interesting interactions, such as that f... |

54 | The Mozart Effect
- Hughes
- 2001
(Show Context)
Citation Context ...laws for imperative functional programming [9]. Our framework is both more general and more thorough than the predominant technique for formalizing the semantics of effects, namely monadic techniques =-=[2, 9, 18, 19, 25]-=-. As evidence of our framework’s generality, in this paper we provide two effect systems whose semantics our framework can formalize but which cannot be formalized using monadic techniques, contrary t... |

51 |
Using category theory to design implicit conversions and generic operators
- Reynolds
- 1980
(Show Context)
Citation Context ... which informally means that all sensible ways to insert implicit semantic operators lead to equivalent semantics. Examples of coherence requirements are Reynolds’ requirements for implicit coercions =-=[20]-=- and the monad laws for imperative functional programming [9]. Our framework is both more general and more thorough than the predominant technique for formalizing the semantics of effects, namely mona... |

40 | Type and effect systems
- Nielson, Nielson
(Show Context)
Citation Context ...e roles that effects play in languages,some of which have not been addressed before. For each role we present both a nominal component for naming effects (the space in which type-and-effect analyses =-=[14, 16, 19, 22, 23, 25]-=- work) and a semantic component for defining the denotational semantics of effects (the space in which monadic techniques typically work). Our framework is also general, making only the assumptions ne... |

35 |
Categorical Logic and Type Theory. Number 141
- Jacobs
- 1999
(Show Context)
Citation Context ...types. We make these assumptions not because of any fundamental limitations of our framework, but because otherwise we would need significantly more complex abstractions such as fibredcategory theory =-=[5]-=-. Although the applications of our work to these domains are also interesting, we feel that they would distract from the main points of the paper and so here we focus on strict programming languages w... |

32 | Combining effects: Sum and tensor
- Hyland, Plotkin, et al.
- 2006
(Show Context)
Citation Context ... in these systems is very restricted. In fact, the multitude of monadic techniques for building effect systems all handle interaction of distinct effects by packing their monads into one larger monad =-=[5, 7, 11, 13, 15]-=-. On the other hand, the bounded non-determinism system is not sequentially compressive, and the state machine system is not increasing, so they can define more interesting interactions between distin... |

31 | Implicit and explicit parallel programming in Haskell
- Jones, Hudak
- 1993
(Show Context)
Citation Context ...roperties of an effect which allow computations in separate threads to be interwoven arbitrarily per the requirements of parallelization, significantly relaxing the requirements of commutative monads =-=[8]-=-. Since each solution specifies its requirements in terms of our abstract framework for effects, these solutions can be applied to any language in any circumstance satisfying those abstract requiremen... |

27 |
Every Standard construction is induced by a pair of Adjoint Functors
- Kleisli
- 1965
(Show Context)
Citation Context ...is a subeffect ofε ′ and g equals convertε≤ε ′ ◦f. This forms a 2-category precisely because of our equality requirements. Those familiar with monads may know of the Kleisli category KM for a monad M =-=[12]-=- and its connection to effectful computations [18]. In fact, each monad is a lax functor from1toCAT, and the construction above applied to this lax functor coincides � with the Kleisli category. This ... |

24 | Composing Monads Using Coproducts
- Lüth, Ghani
- 2002
(Show Context)
Citation Context |

17 | Optimizing ML using a hierarchy of monadic types
- Tolmach
- 1998
(Show Context)
Citation Context |

16 |
Abstract and Concrete Categories, WileyInterscience
- Adameck, Herrlich, et al.
- 1990
(Show Context)
Citation Context ...t system has efficient joins if, whenever ε and ε ′ have a join ε ⊔ ε ′ in the subeffect preorder, the pair of operations 〈convertε≤ε⊔ε′,convertε ′ ≤ε⊔ε ′〉 forms what is known as an extremal epi-sink =-=[1]-=-; that is, every element of Tε⊔ε ′(τ) is in the image of at least one of the two convert operations. If a nominal subeffect system has efficient joins, then that means there is essentially no signific... |

15 | Relaxing the value restriction
- Garrigue
- 2004
(Show Context)
Citation Context ...e, the value restriction [28] allows type generalization when no effects are present. Furthermore, there are techniques for occasionally relaxing the value restriction even in the presence of effects =-=[3]-=-. These identify expressions that can be generalized regardless of the effect present, such as the following program expression: {x ← newRef("ignore"); return (λx.x)} With our framework we can see tha... |

13 | Taming effects with monadic typing
- Kieburtz
- 1998
(Show Context)
Citation Context ...ein’s generic type-and-effect system [17]. Due to their analytical nature, the subeffect system forms a join semi-lattice and sequential composition ; is simply the join operator⊔on this semi-lattice =-=[10, 15, 24]-=-. In particular, there is usually a set of primitive effects, and EFF is simply all finite sets of primitive effects [2, 17, 22, 23]. The basic effect is the bottom of this join semi-lattice (e.g. the... |

11 | A generic type-and-effect system
- Marino, Millstein
- 2009
(Show Context)
Citation Context |

8 |
Two constructions on lax functors, Cahiers de topologie et géométrie différentielle
- Street
- 1972
(Show Context)
Citation Context ... that the category of computations satisfies a couniversal property with respect to the effect system. This theorem is straightforward to prove so we do not do so here. Theorem. KE is the lax colimit =-=[6, 21]-=- of the lax functorE. In particular, the Kleisli category of a monad is the lax colimit of its corresponding lax functor. Thus the above theorem simply indicates that our generalization of monads pres... |