Fiveable

🔢Category Theory Unit 10 Review

QR code for Category Theory practice questions

10.2 Algebras for a monad

10.2 Algebras for a monad

Written by the Fiveable Content Team • Last updated August 2025
Written by the Fiveable Content Team • Last updated August 2025
🔢Category Theory
Unit & Topic Study Guides

Monad algebras provide a way to interpret monadic structures in specific contexts. They consist of a carrier object and a structure map, which must satisfy coherence conditions to ensure consistency with the monad's properties.

These algebras allow us to evaluate monadic computations in various ways. Examples include the identity monad and list monad algebras. Constructing a monad algebra involves defining a structure map and verifying it meets the required conditions.

Algebras for a Monad

Components of monad algebra

  • An algebra for a monad (T,η,μ)(T, \eta, \mu) consists of two components:
    • Carrier object AA represents the target object in the category C\mathcal{C} (e.g., sets, vector spaces)
    • Structure map a:TAAa: TA \to A defines a morphism in C\mathcal{C} that transforms a monadic value of type TATA into a value of type AA
  • The structure map aa must satisfy two coherence conditions to ensure consistency with the monadic structure:
    • Interpreting a pure value using η\eta should not change the value: aηA=idAa \circ \eta_A = id_A
    • Interpreting a monadic computation using μ\mu and then applying the structure map is equivalent to first applying the structure map to the subcomputations and then interpreting the result: aTa=aμAa \circ Ta = a \circ \mu_A
Components of monad algebra, Free monads in category theory (part 1)

Algebras and monadic computations

  • Algebras for a monad provide a way to interpret the monadic structure in a specific context determined by the carrier object AA
  • Monadic computations build up a structure using monadic operations (η\eta and μ\mu)
  • Algebras allow us to evaluate or interpret this structure in a specific way defined by the structure map aa
  • The coherence conditions ensure that the interpretation is consistent with the monadic structure and preserves the properties of the monad
Components of monad algebra, Free monads in category theory (part 1)

Examples of common monad algebras

  • Identity monad (Id,η,μ)(Id, \eta, \mu):
    • Carrier object: any object AA in the category
    • Structure map: identity morphism idA:AAid_A: A \to A
  • List monad (List,η,μ)(List, \eta, \mu):
    • Carrier object: any object AA in the category
    • Structure map a:List(A)Aa: List(A) \to A summarizes a list of values into a single value
      • Sum, product, maximum, or minimum of a list of numbers
      • Concatenating a list of strings into a single string

Construction of monad algebras

  • To construct an algebra for a given monad (T,η,μ)(T, \eta, \mu) and a carrier object AA:
    1. Define a structure map a:TAAa: TA \to A
    2. Check that the structure map satisfies the coherence conditions
  • Example: Constructing an algebra for the list monad with carrier object N\mathbb{N} (natural numbers)
    1. Define the structure map a:List(N)Na: List(\mathbb{N}) \to \mathbb{N} as the sum of the elements in the list
    2. Check the coherence conditions:
      • aηN=idNa \circ \eta_\mathbb{N} = id_\mathbb{N} holds because the sum of a singleton list is the element itself
      • aTa=aμNa \circ Ta = a \circ \mu_\mathbb{N} holds because summing a list of lists and then summing the result is equivalent to first summing each sublist and then summing the resulting list