A couple of weeks ago Angel pointed me to a very nice lecture: Category Theory for Programmers (from/by Bartosz Milewski).

Bartosz Milewski is a physisist, a philosopher (on computer science and life in general :)) and runs his own company to make the world a better place by means of Category Theory and Haskell :).

Monads

The course is long …

  • Category Theory 1.1: Motivation and Philosophy
  • Category Theory 1.2: What is a category?
  • Category Theory 2.1: Functions, epimorphisms
  • Category Theory 2.2: Monomorphisms, simple types
  • Category Theory 3.1: Examples of categories, orders, monoids
  • Category Theory 3.2: Kleisli category
  • Category Theory 4.1: Terminal and initial objects
  • Category Theory 4.2: Products
  • Category Theory 5.1: Coproducts, sum types
  • Category Theory 5.2: Algebraic data types
  • Category Theory 6.1: Functors
  • Category Theory 6.2: Functors in programming
  • Category Theory 7.1: Functoriality, bifunctors
  • Category Theory 7.2: Monoidal Categories, Functoriality of ADTs, Profunctors
  • Category Theory 8.1: Function objects, exponentials
  • Category Theory 8.2: Type algebra, Curry-Howard-Lambek isomorphism
  • Category Theory 9.1: Natural transformations
  • Category Theory 9.2: bicategories
  • Category Theory 10.1: Monads
  • Category Theory 10.2: Monoid in the category of endofunctors

… and every lecture is 45-60 mins, means you need to invest 20 hours (and it helps, if you invest 20 hours before that to learn some Haskell).

But … (from my point of view) it is worth the time, because we have all heard that “Monads are (just) monoids in the category of endofunctors” and have probably reviewed a couple of explanations what that means.

Monads

The truth is that category theory and set theory and type theory are related to each other (maybe they are isomorphic :)) and to get this relationship and to understand this relationship, you need to invest some time and start with the basics.

Bartosz is doing an excellent job to convey these basic concepts and to build up to the last lecture that will explain why a mondad is just a monoid in the category of endofunctors.

If you are interested in learning why functional programming is the superior way to decompose a large problem into smaller components and compose these components to create a solution for the problem at hand, going throught these lectures is highly recommended.