Hacker News new | ask | show | jobs
by bobmichael 2390 days ago
I found the article the author links to, which explains functors, applicatives, and monads in pictures, to be way more helpful: http://adit.io/posts/2013-04-17-functors,_applicatives,_and_...
1 comments

Yeah, interesting to learn that a monad is a value in a box, almost as if it were an object
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...