Understand Category Theory for Computer Scientists
Understand Category Theory for Computer Scientists
kairenner-gh/slates
Last update 2 w. agoCreated on the 23rd of March 2026

Category Theory as a Unifying Language

Category theory studies mathematical structure at the most abstract level: not what mathematical objects are made of, but how they relate to each other. It was developed by Eilenberg and Mac Lane in the 1940s to make precise what "natural" meant when two constructions behaved the same way across all mathematical contexts. It has since become the native language of modern algebra, logic, and theoretical computer science.

Categories

A category consists of objects and morphisms (arrows between objects). Morphisms compose: if there is an arrow from A to B and from B to C, there is an arrow from A to C. Every object has an identity morphism. Composition must be associative and the ident

Functors

A functor is a structure-preserving map between categories. It maps objects to objects and morphisms to morphisms while preserving composition and identities. The List functor maps any type A to the type [A] (list of A) and maps any function f : A to B to

Natural Transformations

A natural transformation is a morphism between functors — a way to convert between two functors systematically. The function head : [A] to Maybe A, which returns the first element or Nothing if the list is empty, is a natural transformation from the List

The Yoneda Lemma

The Yoneda lemma states that a functor F from a category C is completely determined by its behavior on morphisms out of a single object: natural transformations from the representable functor Hom(A, -) to F biject naturally with elements of F(A). This mea

Adjunctions

An adjunction between functors F and G is a natural bijection between morphisms F(A) to B and morphisms A to G(B). Currying and uncurrying are an adjunction between function types. Free and forgetful functors between categories of structured objects (grou

Monads

A monad is a functor T with natural transformations unit : Id to T and join : T∘T to T satisfying coherence laws (associativity and unit laws). The Maybe monad sequences computations that may fail. The IO monad sequences effectful computations. The State

Go Deeper: Category Theory and the Foundations of Probability

Category theory is the mathematics of mathematics — it studies structure and transformation in the most abstract possible setting. Those same categorical structures appear in the foundations of statistics and probability theory, where measure-theoretic probability has a natural categorical formulation.