Monads & Gonads

February 21, 2013

Douglas Crockford gives his version of the obligatory monad tutorial. His version is in Javascript with hopes of needed demystification.

I have to appreciate the freshness of his approach. He says a monad is just an object with certain properties (the monad laws). That's a great way to explain it in an object-oriented context. Objects are the unit of encapsulation. Monads serve the purpose of encapsulating state and allowing structured access to that state.

There is one thing that bothers me about his presentation. He uses mutable objects. I guess that is to be expected in Javascript. But mutating state in a monad seriously limits their possibilities, as mutation does in most uses.

Either way, it is an entertaining watch and a good explanation of monads. Perhaps the most down-to-earth I have seen.