Hacker News new | ask | show | jobs
by itronitron 2390 days ago
Yeah, interesting to learn that a monad is a value in a box, almost as if it were an object
2 comments

It isn’t though. A monad is just an abstract mathematical object that satisfies a few axioms. It doesn’t have anything to do with implementations or computations, let alone objects in the OOP sense.

It’s better to think of it like this: a value in a box is one example of a data type that can satisfy the monad axioms. Another example is a delayed computation that produces a value when executed. Yet another is a delayed computation which produces no value at all but causes a message to be printed to the screen.

The problem is, of course, that a monad is not a value in a box. That's a misunderstanding, resulting from an oversimplified metaphor. This shows a frequent problem with metaphors.

See "the fallacy of monad tutorials": https://byorgey.wordpress.com/2009/01/12/abstraction-intuiti...