### Monads are like a dildo factory, staffed by midgets

At their most basic, monads are a monoid in the category of endofunctors. But that’s an explanation that only appears to mathematicians. They are also a design pattern, but that’s an explanation that only appeals to computer geeks.

You’ve read many monad tutorials. For instance, monads are like monsters. No wait, monads are like space suits, and functions of type a -> M b are like space brothels where you take off your suit, get space herpes and then put your suit back on. But this post is the ultimate in monad tutorials - this is the one that will finally cause them to make sense in your mind.

So consider a program being used to run a dildo factory. The most basic underlying type is the Dildo:

data Dildo = NormalDildo | Rabbit | StrapOn | ...


We also have a data type representing the box:

data Box a = Box a


Now consider one of the midgets, who’s job it is to do work to a dildo and put it into a box. In the abstract, the type signature of the midget is Dildo -> Box Dildo. But sometimes the midgets need to take a dildo out of the box, do some work on it, and put it back into the box. Monads to the rescue.