---
tag: 53TSQ57J0H
kind: definition
name: Kleisli category
msc: ["18C20", "18C15"]
defines: D9YHA46YWM
uses: [A2DE66937D, FF6XXA6D1A]
sources:
  - url: https://en.wikipedia.org/wiki/Kleisli_category
---

## Definition

Let $\mathcal{C}$ be a [[category|A2DE66937D]] and let $(T, \eta, \mu)$ be a [[monad|FF6XXA6D1A]] on $\mathcal{C}$, with unit $\eta \colon \mathrm{Id} \to T$ and multiplication $\mu \colon T T \to T$.
The *Kleisli category* $\mathcal{C}_T$ is the category given as follows.

1. Its objects are the objects of $\mathcal{C}$.
2. A morphism $X \to Y$ in $\mathcal{C}_T$ is a morphism $f \colon X \to T Y$ in $\mathcal{C}$.
3. The composite of $f \colon X \to T Y$ and $g \colon Y \to T Z$ is $g \circ_T f = \mu_Z \circ T g \circ f \colon X \to T Z$.
4. The identity on $X$ is $\eta_X \colon X \to T X$.

## Remarks

The monad laws $\mu \circ T \eta = \mathrm{id} = \mu \circ \eta T$ and $\mu \circ T \mu = \mu \circ \mu T$ give the identity laws and the associativity of $\circ_T$.
The functor $\mathcal{C} \to \mathcal{C}_T$, $f \mapsto \eta \circ f$, has a right adjoint $\mathcal{C}_T \to \mathcal{C}$ that sends $X$ to $T X$ and $f$ to $\mu \circ T f$, and this adjunction induces $T$.

Example: let $T$ be the monad $X \mapsto X \sqcup \set{\ast}$ on $\mathbf{Set}$, with $\eta_X$ the inclusion and $\mu_X$ sending both added points to $\ast$.
A Kleisli morphism $X \to Y \sqcup \set{\ast}$ is a partial function from $X$ to $Y$, undefined where the value is $\ast$, and $\circ_T$ is composition of partial functions.
So $\mathbf{Set}_T$ is isomorphic to the category of sets and partial functions.

Non-example: composing $f \colon X \to T Y$ and $g \colon Y \to T Z$ by $T g \circ f$ alone gives a morphism $X \to T T Z$, not $X \to T Z$.
Without the multiplication $\mu$, clause 3 does not produce a morphism of the right type.

For the monad of a variety on $\mathbf{Set}$, the Kleisli category is equivalent to the category of free algebras of the variety and the homomorphisms between them.
