Starting from the definition of what we mean by “algebra”, we’ll try to see why the “Free Monad” is Free, why this name makes sense, what it means in the mathematical world and how to construct one. But don’t be scared! Some programming background will be more than enough to understand the talk; no special maths training is required.
If you are following the evolution of FP, free monads are popping up more and more frequently, not only in blogs but also in everyday programming. Hence it might be useful to see what are the origins of free; it appears in universal algebra and category theory, and that’s where we’ll be looking!
We’ll take several steps. Starting from algebras, we’ll construct a free algebra over a signature and a set of equations. Then we’ll be quite close to generalising this to a free object over any functor and category. Finally, we’ll be able to reach our goal: the free monad.