Reference. Algebraic foundations for effect-dependent optimisations
Cite
Cited by (8)
Handling Higher-Order Effectful Operations with Judgemental Monadic Laws yang-2026-handling
This paper studies the design of programming languages with handlers of higher-order effectful operations - effectful operations that may take in computations as arguments or return computations as output. We present and analyse a core calculus with higher-kinded impredicative polymorphism, handlers of higher-order effectful operations, and optionally general recursion. The distinctive design choice of this calculus is that handlers are carried by lawless raw monads, while the computation judgements still satisfy the monadic laws judgementally. We present the calculus with a logical framework and give denotational models of the calculus using realizability semantics. We prove closed-term canonicity and parametricity for the recursion-free fragment of the language using synthetic Tait computability and a novel form of the ⊤⊤-lifting technique.
Two-sorted algebraic decompositions of Brookes’s shared-state denotational semantics dvir-2025-two
We define a two sorted equational theory of algebraic effects that models concurrent shared state with preemptive interleaving, recovering Brookes’s seminal 1996 trace-based model precisely. The decomposition allows us to analyse Brookes’s model algebraically in terms of separate but interacting components. The multiple sorts partition terms into layers. We use two sorts: a “hold” sort for layers that disallow interleaving of environment memory accesses, analogous to holding a global lock on the memory; and a “cede” sort for the opposite. The algebraic signature comprises of independent interlocking components: two new operators that switch between these sorts, delimiting the atomic layers, thought of as acquiring and releasing the global lock; non-deterministic choice; and state-accessing operators. The axioms similarly divide cleanly: the delimiters behave as a closure pair; all operators are strict, and distribute over non-empty non-deterministic choice; and non-deterministic global state obeys Plotkin and Power’s presentation of global state. Our representation theorem expresses the free algebras over a two-sorted family of variables as sets of traces with suitable closure conditions. When the held sort has no variables, we recover Brookes’s trace semantics. We define several other single-and two-sorted theories to elucidate the connection to Brookes’s model via translation embeddings and equivalences.
Fully abstract models for effectful λ-calculi via category-theoretic logical relations kammar-2022-fully
We present a construction which, under suitable assumptions, takes a model of Moggi’s computational λ-calculus with sum types, effect operations and primitives, and yields a model that is adequate and fully abstract. The construction, which uses the theory of fibrations, categorical glueing, ⊤⊤-lifting, and ⊤⊤-closure, takes inspiration from O’Hearn & Riecke’s fully abstract model for PCF. Our construction can be applied in the category of sets and functions, as well as the category of diffeological spaces and smooth maps and the category of quasi-Borel spaces, which have been studied as semantics for differentiable and probabilistic programming.
An Algebraic Theory for Shared-State Concurrency dvir-2022-an
Structured Handling of Scoped Effects yang-2022-structured
Algebraic effects offer a versatile framework that covers a wide variety of effects. However, the family of operations that delimit scopes are not algebraic and are usually modelled as handlers, thus preventing them from being used freely in conjunction with algebraic operations. Although proposals for scoped operations exist, they are either ad-hoc and unprincipled, or too inconvenient for practical programming. This paper provides the best of both worlds: a theoretically-founded model of scoped effects that is convenient for implementation and reasoning. Our new model is based on an adjunction between a locally finitely presentable category and a category of functorial algebras . Using comparison functors between adjunctions, we show that our new model, an existing indexed model, and a third approach that simulates scoped operations in terms of algebraic ones have equal expressivity for handling scoped operations. We consider our new model to be the sweet spot between ease of implementation and structuredness. Additionally, our approach automatically induces fusion laws of handlers of scoped effects, which are useful for reasoning and optimisation.
A domain theory for statistical probabilistic programming vakar-2019-a
We give an adequate denotational semantics for languages with recursive higher-order types, continuous probability distributions, and soft constraints. These are expressive languages for building Bayesian models of the kinds used in computational statistics and machine learning. Among them are untyped languages, similar to Church and WebPPL, because our semantics allows recursive mixed-variance datatypes. Our semantics justifies important program equivalences including commutativity. Our new semantic model is based on ‘quasi-Borel predomains’. These are a mixture of chain-complete partial orders (cpos) and quasi-Borel spaces. Quasi-Borel spaces are a recent model of probability theory that focuses on sets of admissible random elements. Probability is traditionally treated in cpo models using probabilistic powerdomains, but these are not known to be commutative on any class of cpos with higher order functions. By contrast, quasi-Borel predomains do support both a commutative probabilistic powerdomain and higher-order functions. As we show, quasi-Borel predomains form both a model of Fiore’s axiomatic domain theory and a model of Kock’s synthetic measure theory.
On the expressive power of user-defined effects: Effect handlers, monadic reflection, delimited control forster-2019-on
We compare the expressive power of three programming abstractions for user-defined computational effects: Plotkin and Pretnar’s effect handlers, Filinski’s monadic reflection, and delimited control. This comparison allows a precise discussion about the relative expressiveness of each programming abstraction. It also demonstrates the sensitivity of the relative expressiveness of user-defined effects to seemingly orthogonal language features. We present three calculi, one per abstraction, extending Levy’s call-by-push-value. For each calculus, we present syntax, operational semantics, a natural type-and-effect system, and, for effect handlers and monadic reflection, a set-theoretic denotational semantics. We establish their basic metatheoretic properties: safety, termination, and, where applicable, soundness and adequacy. Using Felleisen’s notion of a macro translation, we show that these abstractions can macro express each other, and show which translations preserve typeability. We use the adequate finitary set-theoretic denotational semantics for the monadic calculus to show that effect handlers cannot be macro expressed while preserving typeability either by monadic reflection or by delimited control. Our argument fails with simple changes to the type system such as polymorphism and inductive types. We supplement our development with a mechanised Abella formalisation.
Handlers in action kammar-2013-handlers
Cites 46 works (2 here)
With notes (2)
Parameterised notions of computation atkey-2009-parameterised
Moggi’s Computational Monads and Power et al .‘s equivalent notion of Freyd category have captured a large range of computational effects present in programming languages. Examples include non-termination, non-determinism, exceptions, continuations, side effects and input/output. We present generalisations of both computational monads and Freyd categories, which we call parameterised monads and parameterised Freyd categories, that also capture computational effects with parameters. Examples of such are composable continuations, side effects where the type of the state varies and input/output where the range of inputs and outputs varies. By considering structured parameterisation also, we extend the range of effects to cover separated side effects and multiple independent streams of I/O. We also present two typed λ-calculi that soundly and completely model our categorical definitions – with and without symmetric monoidal parameterisation – and act as prototypical languages with parameterised effects.
Call-By-Push-Value: A Functional/Imperative Synthesis levy-2003-callbypushvalue
External (44)
- Monads in action (2010)
- A Generic Operational Metatheory for Algebraic Effects (2010)
- Segal Condition Meets Computational Effects (2010)
- Algebras for Parameterised Monads (2009)
- Relational semantics for effect-based program transformations (2009)
- A generic type-and-effect system (2009)
- Handlers of Algebraic Effects (2009)
- Two Cotensors in One: Presentations of Algebraic Theories for Local State and Fresh Names (2009)
- PhD thesis, University of Edinburgh (M. Pretnar) (2009)
- A Logic for Algebraic Effects (2008)
- Semantics of an effect analysis for exceptions (2007)
- Relational semantics for effect-based program transformations with dynamic allocation (2007)
- On the relations between monadic semantics (2007)
- The Category Theoretic Understanding of Universal Algebra: Lawvere Theories and Monads (2007)
- Combining algebraic effects with continuations (2007)
- Reading, Writing and Relations (2006)
- Discrete Lawvere theories and computational effects (2006)
- Combining effects: Sum and tensor (2006)
- Countable Lawvere Theories and Computational Effects (2006)
- Some Varieties of Equational Logic (2006)
- Computational Effects and Operations: An Overview (2004)
- The marriage of effects and monads (2003)
- Varieties of Effects (2002)
- Possible World Semantics for General Storage in Call-By-Value (2002)
- Adequacy for Algebraic Effects (2001)
- PhD thesis, University of Edinburgh (C. Führmann) (2000)
- Enriched Lawvere theories (2000)
- Monads, Effects and Transformations (1999)
- Representing layered monads (1999)
- Taming effects with monadic typing (1998)
- Optimizing ML using a hierarchy of monadic types (1998)
- The marriage of effects and monads (1998)
- Region-Based Memory Management (1997)
- Semantics of weakening and contraction (1994)
- A Syntactic Approach to Type Soundness (1994)
- Domain theory (Handbook of Logic in Computer Science, vol. 3) (1994)
- Inheritance as implicit coercion (1991)
- Type systems for programming languages (1990)
- Polymorphic effect systems (1988)
- Full abstraction for a simple parallel programming language (1979)
- A Powerdomain Construction (1976)
- On the Relation between Direct and Continuation Semantics (1974)
- Bilinearity and Cartesian Closed Monads. (1971)
- Group-like structures in general categories I multiplications and comultiplications (1962)