News for hackers. Stuff that matters.
Re:Monads in JavaScript by im3w1l on Tuesday July 21, 2015 @07:34AM (#9921501)
There are many monads, so the answer will depend on which one it is. For instance the "Maybe" monad I described in a sibling comment to yours could be implemented with a pointer that could be null, or not.

Another Monad could be a Logger monad. "return" transform a value into a pair of a value and an empty log. So in this case a monad int could be implemented as a pair<int, string>. (bind would take a function that starts logging from scratch and make it a function that appends to a preexisting log).

There are no comments on this comment yet.