Reference. Modular Models of Monoids with Operations
Inspired by algebraic effects and the principle of notions of computations as monoids, we study a categorical framework for equational theories and models of monoids equipped with operations. The framework covers not only algebraic operations but also scoped and variable-binding operations. Appealingly, in this framework both theories and models can be modularly composed. Technically, a general monoid-theory correspondence is shown, saying that the category of theories of algebraic operations is equivalent to the category of monoids. Moreover, more complex forms of operations can be coreflected into algebraic operations, in a way that preserves initial algebras. On models, we introduce modular models of a theory, which can interpret abstract syntax in the presence of other operations. We show constructions of modular models (i) from monoid transformers, (ii) from free algebras, (iii) by composition, and (iv) in symmetric monoidal categories.
Cite
Cited by (5)
Modular models of monoids with operations by lifting functors along fibrations yang-2026-modular
Inspired by Plotkin and Power’s algebraic treatment of computational effects and the principle of notions of computations as monoids, we propose a categorical framework for equational theories and models of monoids equipped with operations. This framework generalises Plotkin and Power’s algebraic treatment of effectful operations taking or returning values as input or output to operations that may take or return computations as input or output. Additionally, to give semantic models of computational effects in a modular way, we introduce a formal theory of modular constructions of algebraic structures based on the framework of lifting functors along fibrations.
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.
Scoped Effects, Scoped Operations, and Parameterized Algebraic Theories matache-2025-scoped
Notions of computation can be modeled by monads. Algebraic effects offer a characterization of monads in terms of algebraic operations and equational axioms, where operations are basic programming features, such as reading or updating the state, and axioms specify observably equivalent expressions. However, many useful programming features depend on additional mechanisms such as delimited scopes or dynamically allocated resources. Such mechanisms can be supported via extensions to algebraic effects including scoped effects and parameterized algebraic theories . We present a fresh perspective on scoped effects by translation into a variation of parameterized algebraic theories. The translation enables a new approach to equational reasoning for scoped effects and gives rise to an alternative characterization of monads in terms of generators and equations involving both scoped and algebraic operations. We demonstrate the power of our approach by way of equational characterizations of several known models of scoped effects.
Algebraic Effects Meet Hoare Logic in Cubical Agda kidney-2024-algebraic
This paper presents a novel formalisation of algebraic effects with equations in Cubical Agda. Unlike previous work in the literature that employed setoids to deal with equations, the library presented here uses quotient types to faithfully encode the type of terms quotiented by laws. Apart from tools for equational reasoning, the library also provides an effect-generic Hoare logic for algebraic effects, which enables reasoning about effectful programs in terms of their pre- and post-conditions. A particularly novel aspect is that equational reasoning and Hoare-style reasoning are related by an elimination principle of Hoare logic.
Scoped Effects as Parameterized Algebraic Theories lindley-2024-scoped
Notions of computation can be modelled by monads. Algebraic effects offer a characterization of monads in terms of algebraic operations and equational axioms, where operations are basic programming features, such as reading or updating the state, and axioms specify observably equivalent expressions. However, many useful programming features depend on additional mechanisms such as delimited scopes or dynamically allocated resources. Such mechanisms can be supported via extensions to algebraic effects including scoped effects and parameterized algebraic theories . We present a fresh perspective on scoped effects by translation into a variation of parameterized algebraic theories. The translation enables a new approach to equational reasoning for scoped effects and gives rise to an alternative characterization of monads in terms of generators and equations involving both scoped and algebraic operations. We demonstrate the power of our fresh perspective by way of equational characterizations of several known models of scoped effects.
Cites 71 works (12 here)
With notes (12)
Formal metatheory of second-order abstract syntax fiore-2022-formal
Despite extensive research both on the theoretical and practical fronts, formalising, reasoning about, and implementing languages with variable binding is still a daunting endeavour – repetitive boilerplate and the overly complicated metatheory of capture-avoiding substitution often get in the way of progressing on to the actually interesting properties of a language. Existing developments offer some relief, however at the expense of inconvenient and error-prone term encodings and lack of formal foundations. We present a mathematically-inspired language-formalisation framework implemented in Agda. The system translates the description of a syntax signature with variable-binding operators into an intrinsically-encoded, inductive data type equipped with syntactic operations such as weakening and substitution, along with their correctness properties. The generated metatheory further incorporates metavariables and their associated operation of metasubstitution, which enables second-order equational/rewriting reasoning. The underlying mathematical foundation of the framework – initial algebra semantics – derives compositional interpretations of languages into their models satisfying the semantic substitution lemma by construction.
Breadth-First Traversal via Staging gibbons-2022-breadth
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.
Reasoning about effect interaction by fusion yang-2021-reasoning
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.
Kan Extensions for Program Optimisation Or: Art and Dan Explain an Old Trick hinze-2012-kan
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.
Second-Order and Dependently-Sorted Abstract Syntax fiore-2008-second
Applicative programming with effects mcbride-2008-applicative
In this article, we introduce Applicative functors – an abstract characterisation of an applicative style of effectful programming, weaker than Monads and hence more widespread. Indeed, it is the ubiquity of this programming pattern that drew us to the abstraction. We retrace our steps in this article, introducing the applicative pattern by diverse examples, then abstracting it to define the Applicative type class and introducing a bracket notation that interprets the normal application syntax in the idiom of an Applicative functor. Furthermore, we develop the properties of applicative functors and the generic operations they support. We close by identifying the categorical structure of applicative functors and examining their relationship both with Monads and with Arrow.
Categorical Logic and Type Theory jacobs-1999
This book is an attempt to give a systematic presentation of both logic and type theory from a categorical perspective, using the unifying concept of fibred category. Its intended audience consists of logicians, type theorists, category theorists and (theoretical) computer scientists.
Introduction to Higher-Order Categorical Logic lambek_scott_1986
Functorial Semantics of Algebraic Theories lawvere_1963
Abstract syntax and variable binding fiore_etal_nd
We develop a theory of abstract syntax with variable binding. To every binding signature we associate a category of models consisting of variable sets endowed with compatible algebra and substitution structures. The syntax generated by the signature is the initial model. This gives a notion of initial algebra semantics encompassing the traditional one; besides compositionality, it automatically verifies the semantic substitution lemma.
External (59)
- Hefty Algebras: Modular Elaboration of Higher-Order Algebraic Effects (2023)
- Flexible presentations of graded monads (2022)
- Flexibly Graded Monads and Graded Algebras (2022)
- What Makes a Strong Monad? (2022)
- Algebras for weighted search (2021)
- (Co)end Calculus (2021)
- Graded Algebraic Theories (2020)
- Generalized monoidal effects and handlers (2020)
- Build systems à la carte (2018)
- Syntax and Semantics for Operations with Scopes (2018)
- List Objects with Algebraic Structure (2017)
- Classical lambda calculus in modern dress (2017)
- Notions of computation as monoids (2017)
- Freer monads, more extensible effects (2015)
- Functorial Semantics of Second-Order Algebraic Theories (2014)
- Substitution, jumps, and algebraic effects (2014)
- Parametric effect monads and semantics of effect systems (2014)
- Effect handlers in scope (2014)
- Handling Algebraic Effects (2013)
- Constructing Applicative Functors (2012)
- mtl: Monad classes, using functional dependencies (software) (2012)
- Monad transformers as monoid transformers (2010)
- On the construction of free algebras for equational systems (2009)
- Categorical semantics for arrows (2009)
- Free-algebra models for the π-calculus (2008)
- Data types à la carte (2008)
- Asymptotic Improvement of Computations over Free Monads (2008)
- Equational Systems and Free Constructions (Extended Abstract) (2007)
- Monadic augment and generalised short cut fusion (2007)
- Explicit substitutions and higher-order syntax (2006)
- Coproducts of Ideal Monads (2004)
- Computational Effects and Operations: An Overview (2004)
- Algebraic Operations and Generic Effects (2003)
- Notions of Computation Determine Monads (2002)
- Semantics for Algebraic Operations (2001)
- Representable Multicategories (2000)
- Generalising monads to arrows (2000)
- Representing layered monads (1999)
- Enriched Lawvere Theories (1999)
- Categories for the Working Mathematician (2nd edn) (1998)
- Monad transformers and modular interpreters (1995)
- Monads for Functional Programming (1995)
- Locally Presentable and Accessible Categories (1994)
- Representing monads (1994)
- A short cut to deforestation (1993)
- Adjunctions whose counits are coequalizers, and presentations of finitary enriched monads (1993)
- A Syntactic Approach to Modularity in Denotational Semantics (1993)
- Notions of computation and monads (1991)
- Semantics of programming languages (1991)
- An Abstract View of Programming Languages (1989)
- Computational lambda-calculus and monads (1989)
- A novel representation of lists and its application to the function “reverse” (1986)
- Types, Abstraction and Parametric Polymorphism (1983)
- Structures defined by finite limits in the enriched context (1982)
- Universal Algebra (1981)
- Free Algebras and Automata Realizations in the Language of Categories (1974)
- Strong functors and monoidal monads (1972)
- On Closed Categories of Functors (1970)
- Some Aspects of Equational Categories (1966)