Re:Monads in JavaScript
by tel on Tuesday July 21, 2015 @08:39AM
(#9921765)
You need "return" too. Can't get that from merely being a functor.
[ Parent
| on HN ]
Re:Monads in JavaScript
by belovedeagle on Saturday July 25, 2015 @02:04PM
(#9948402)
> and also that there is a left- and right-identity 'return: a -> f a'
RTF, uh, Comment.
The point being that I think it's best to understand return in the context of the more important operation join. You might wonder, "well why don't functors have a generic constructor", and (among other answers to that) the reason is that it doesn't serve any purpose in the functor laws. But return does serve a purpose for the monad laws, namely, being an identity of sorts.