Monads and Algebras over a Monad

A monad on a category is a monoid in the category of endofunctors: an endofunctor equipped with a unit and multiplication satisfying associativity and unit laws. An algebra over the monad (Eilenberg–Moore algebra) is an object with a structure map compatible with and . Every adjunction generates a monad, and every monad arises from an adjunction in two canonical ways — via the Kleisli and Eilenberg–Moore categories. Applied across universal algebra, topology, functional programming, and descent theory. Originated by Godement (1958), Huber, Kleisli, Eilenberg–Moore, and Beck (1960s).

A monad packages a notion of "algebraic structure" or "computational effect" into a single endofunctor with two natural transformations. Precisely, it is a monoid object in the strict monoidal category . The notion matters because monads encapsulate, in a uniform categorical language, the free–forgetful adjunctions of universal algebra (groups, rings, modules, lattices), the manipulation of effects in semantics of programming languages, and the theory of descent and codescent. The single most surprising fact is Beck's monadicity theorem: a category equipped with a functor to is — up to equivalence — the category of algebras of a monad precisely when three explicitly checkable conditions hold, turning "is this an algebraic category?" into a finite verification.

The Core Insight

Adjunctions and monads are two faces of the same phenomenon. An adjunction between and produces a monad on that remembers the composite round-trip and forgets the intermediate category . The monad alone cannot reconstruct , but it can reconstruct two canonical "best approximations": the Kleisli category (the initial adjunction giving ) and the Eilenberg–Moore category (the terminal one). All adjunctions inducing sit between these extremes, and the original is monadic exactly when the comparison functor is an equivalence.

Formal Statement

Monad

A monad on a category is a triple where is an endofunctor, (the unit), and (the multiplication) are natural transformations satisfying the associativity and left/right unit coherence laws.

1
⟳Both sides are the two ways to collapse ; equality is the monoid associativity condition transported to under horizontal composition .
2
⟳Insert a unit on the left or right factor of and multiply; this is the monoid unit law for the monoid .

Here are the whiskerings: and . Likewise and . The diagrams asserted componentwise are, for every object :

3
⟳Evaluate and at an object ; the symbols unwind to the indicated component morphisms.

Eilenberg–Moore Algebra over a Monad

Given a monad , a -algebra (or Eilenberg–Moore algebra) is a pair with and a morphism (the structure map) satisfying:

4
⟳A "generator" , embedded via into the free structure , must evaluate back to itself.
5
⟳Evaluating a doubly-nested formal expression either by first multiplying () then evaluating, or by first evaluating the inner layer () then the outer, gives the same result — exactly the associativity of an action.

A morphism of -algebras is a -morphism with . These form the Eilenberg–Moore category , with forgetful functor , .

Kleisli Category

The Kleisli category has the same objects as . A morphism in is a -morphism . The identity on is , and Kleisli composition of and is:

6
⟳Lift to act on via , apply first, then flatten with ; associativity of follows from , units from .

Adjunctions Generate Monads

Let and with , unit and counit . Then with the given and with is a monad on .

7
⟳The triangle identities and , whiskered appropriately, yield the monad unit laws ; the naturality of yields associativity .

Eilenberg–Moore and Kleisli Adjunctions; Comparison

Every monad on arises from at least two adjunctions:

  • The Eilenberg–Moore adjunction where is the free -algebra and , with .
  • The Kleisli adjunction between and , with .

Among all adjunctions inducing , the Kleisli adjunction is initial and the Eilenberg–Moore adjunction is terminal in the category of such adjunctions. There is a fully faithful comparison functor exhibiting as the full subcategory of free algebras, and for any adjunction inducing a unique comparison functor with and .

8
⟳ carries a -action because the counit at gives ; applying produces a structure map; the algebra laws are the triangle identity and the naturality of .

Why It Holds / Derivation

Adjunction ⇒ Monad (verification of the laws)

Let with unit , counit , satisfying the triangle identities

9
⟳These are the defining zig-zag equations of any adjunction, expressed with whiskering.

Step 1 — Set , . Then is a natural transformation since is natural and are functors; whiskering preserves naturality. Step 2 — Right unit . Compute . Then
using functoriality of and the first triangle identity of . Step 3 — Left unit . Here . Then
using the second triangle identity. (Whiskering by on the right is functorial.) Step 4 — Associativity . Both sides are transformations . We have and . The interchange law applied to the naturality square of at the morphism itself — i.e. as transformations — gives, after whiskering by on the left and on the right, exactly .

Free $T$-algebras and the unit/counit of $F^T\dashv U^T$

Define . It is an algebra: the unit law for it reads , which is the left half of ; the associativity law reads , which is the left half of evaluated at . So is a genuine -algebra.

Adjunction data. The unit of at is . The counit at an algebra is the algebra map
10
⟳ is an algebra morphism because says , exactly the morphism condition .

The triangle identities for are (which is ) and (right half of ). Hence and with the original .

The two universal resolutions of a monad: Kleisli (initial) and Eilenberg–Moore (terminal)

Adjunctions inducing a fixed monad T on C C Kleisli C_T (initial) Eilenberg–Moore C^T (terminal) D U_T ⊣ F_T U ⊣ F U^T ⊣ F^T comparison functors K , Φ → C^T K: C_T → C^T fully faithful (free algebras); Φ: D → C^T unique with U^T Φ = U D is MONADIC ⇔ Φ is an equivalence (Beck) T = U_T F_T = U F = U^T F^T (all recover the same monad)

Jonathan Mock Beck | 1935–2006

Beck's 1967 Columbia thesis crystallized monad theory into a working tool. He proved the monadicity (tripleability) theorem, giving a sharp criterion for when a forgetful functor exhibits its source as the algebras of a monad, and he introduced distributive laws for composing monads. The associated Beck–Chevalley condition and Beck's bar/cobar resolution (the simplicial object built from ) underpin descent theory and monadic cohomology. The term "triple" — Beck's and Eilenberg's preferred word for "monad" — survives in the older literature; Mac Lane popularized "monad" by analogy with the monoid law.

Building Intuition

Think of as "the free gadget on a set of generators." For the monad on Set sending (underlying set of the free monoid ), an element of is a formal word in the generators . The unit injects a generator as a length-one word. The multiplication takes a "word of words" and concatenates — flattening one layer of nesting. The associativity law says flattening a triply-nested expression is unambiguous; the unit laws say a single generator wrapped trivially flattens back to itself.

An algebra then says: " knows how to evaluate formal words into honest elements," coherently. For the monoid monad, an algebra is exactly a monoid: reads off the product of any formal word. The slogan is: a monad is a theory of formal expressions; an algebra is a model of that theory. The Kleisli category is the world of "programs that produce -effects," while the Eilenberg–Moore category is the world of "all models," and free models embed into it.

Roger Godement | 1921–2016

Though a number theorist and functional analyst, Godement introduced in his 1958 Topologie algébrique et théorie des faisceaux the standard construction (now the "monad of a comonad" / the Godement resolution): given a sheaf, the canonical flasque resolution iterates an endofunctor with exactly the comonad/monad coherences. This was the first systematic appearance of the data as a computational device, used to define sheaf cohomology via the Godement (bar) resolution. The pattern — build a simplicial object from iterated and take cohomology — became the template for monadic cohomology of all algebraic theories.

Worked Examples

The power-set monad and its algebras = complete sup-lattices

Given. On Set, let (covariant power set), , and , . Step 1 — Check monad laws. Unit: and , giving . Associativity: for ,
confirming . Step 2 — Decode an algebra. A structure map with (unit ) and (coherence ). Setting makes a complete join operation: is a bottom element, is monotone and idempotent on the induced order. Step 3 — Identify the category. Algebra morphisms are exactly sup-preserving maps.
The free algebra on a set is , the power set ordered by inclusion.

The free-vector-space monad and its algebras = vector spaces; a numeric Kleisli computation

Given. Fix a field . On Set, . Unit . Multiplication substitutes a combination-of-combinations and re-collects coefficients. Step 1 — Algebra = -vector space. A structure map assigns to a formal combination its actual value . Laws force to carry a -vector-space structure and morphisms to be -linear; thus . Step 2 — A concrete Kleisli composite over . Take , and Kleisli arrows
By , . First applied to gives the element-of- ""; then collects:
Step 3 — Sanity check via matrices. Linear maps compose to the matrix .

Common Misconceptions

A monad is not the same as its Kleisli category, nor as its algebras. The data on determines both and , but these are generally very different categories: is (equivalent to) the full subcategory of free algebras inside . Confusing "model" (object of ) with "computation" (morphism of ) is the single most common error. Also: the unit and multiplication are natural transformations, not arbitrary morphisms; their naturality squares are needed in nearly every proof. And the monad laws are about , , — not about any particular adjunction — so different adjunctions can yield isomorphic monads while having inequivalent middle categories .

Not every endofunctor with "obvious" unit/mult is a monad; and not every adjunction-free $T$ has algebras = something familiar

Consider on Set with . There is no natural making this a monad: any attempt (e.g. project to the diagonal pairs) violates the unit law , because and cannot both equal the identity for a multiplication that discards coordinates. Concretely, one checks for that no natural transformation of the right type satisfies .

A subtler point: the continuation monad on Set is a monad and is monadic, but is not a category of finitary algebraic structures — it is not a variety in the sense of universal algebra, because does not preserve filtered colimits. This shows "Eilenberg–Moore category" is strictly more general than "category of algebras of an equational theory."

Connections

Monads sit at a crossroads of category theory. They are precisely monoids in , linking them to Monoidal Categories and the general theory of monoid objects. Dualizing every arrow gives Comonads and Coalgebras, whose coalgebras model coinductive/state-based systems. The relationship is the categorical heart of Adjoint Functors, and the question of whether is settled by Beck's Monadicity Theorem. In algebra, finitary monads on Set correspond exactly to Lawvere Theories and to varieties of universal algebra, while in semantics monads model Computational Effects (Moggi). Composing monads requires Distributive Laws of Monads, and the simplicial bar construction from feeds Monadic Cohomology and Descent.

Real-World Applications

  1. Functional programming (Haskell, Scala, F#). The Maybe, List, State, IO, and Reader monads structure side effects and partiality; >>= (bind) is Kleisli composition , return is , join is . The do-notation desugars to Kleisli composites.
  2. Denotational semantics (Moggi's computational -calculus). Effects — exceptions, nondeterminism, probability, continuations — are uniformly modeled by monads on a base semantic category, separating values () from computations ().
  3. Universal algebra. Groups, rings, modules, Boolean algebras, lattices arise as for the free-algebra monad; Beck's theorem certifies these as monadic, justifying "free–forgetful" reasoning.
  4. Sheaf and group cohomology. Godement's standard resolution and Beck's bar resolution compute derived functors via iterated ; , , and group cohomology are monadic cohomology in disguise.
  5. Topology and analysis. Compact Hausdorff spaces are the algebras of the ultrafilter monad on Set (Manes' theorem); convex sets / compact convex sets arise from the probability/distribution monad (Giry monad on measurable spaces).
  6. Probability theory. The Giry monad and the distribution monad give a categorical foundation for Markov kernels: Kleisli composition is the Chapman–Kolmogorov composition of stochastic maps.
  7. Database and query theory. Monads model collection types (sets, bags, lists) and the "comprehension" semantics of query languages (Wadler, Buneman), where joins are Kleisli composites.

Historical Development

  • 1958 — Roger Godement introduces the standard construction (the comonad/monad of a resolution) in Topologie algébrique et théorie des faisceaux; first appearance of the coherences in practice.
  • 1958–1960 — Peter Huber, studying homotopy and adjunctions, observes that every adjunction yields the structure now called a monad; this circulates among Eilenberg's collaborators.
  • 1962 — Samuel Eilenberg and J. C. Moore, in Adjoint functors and triples, define triples (= monads) abstractly and construct the Eilenberg–Moore category of algebras; prove the free–forgetful adjunction .
  • 1965 — Heinrich Kleisli constructs the Kleisli category , exhibiting every monad as arising from an adjunction in a second, initial way.
  • 1965 — Fred Linton connects finitary monads on Set with equational theories, foreshadowing the Lawvere-theory correspondence.
  • 1967 — Jonathan Beck's Columbia thesis proves the monadicity (tripleability) theorem and introduces distributive laws and the bar resolution; the Beck–Chevalley condition emerges.
  • 1969 — Saunders Mac Lane's Categories for the Working Mathematician adopts and popularizes the name monad and organizes the theory (Chapter VI).
  • 1976 — Ernest Manes proves compact Hausdorff spaces = algebras of the ultrafilter monad, a striking non-equational monadicity result.
  • 1991 — Eugenio Moggi's Notions of computation and monads imports monads into programming-language semantics; soon adopted by Wadler and the Haskell community, making monads a mainstream computational tool.

Subtleties & Limits

Several structural questions remain technically delicate or actively studied. (1) Monadicity beyond the elementary toposes: characterizing exactly which functors between higher categories are monadic (the -categorical monadicity theorem of Lurie) and how monadic descent behaves in the -setting is still being worked out. (2) Composing monads: two monads compose to a monad only given a distributive law satisfying four coherence laws; deciding whether a distributive law exists — and classifying them, including "no-go" theorems (e.g. there is no distributive law combining the list monad with itself in certain ways) — is subtle and has yielded surprising negative results. (3) Algebraic vs. non-algebraic effects: which monads correspond to algebraic theories with operations and equations (Plotkin–Power) versus genuinely non-finitary effects (continuations) is a fine boundary; effect handlers exploit exactly the algebraic ones. (4) Codensity monads and ultrafilters: the codensity monad of the inclusion is the ultrafilter monad (Kennison–Gildenhuys, Leinster), and the general theory of codensity monads as "limits over a for