Re:Monads Explained Quickly
by kccqzy on Saturday April 09, 2016 @12:15AM
(#11459872)
Firstly the article says a monad needs to have a way to extract the value out of it. This is patently false. The most famous monad of all, the IO monad doesn't have a way to extract anything from it (notwithstanding evil trickery). Secondly the article says it needs a way to map a function over it. This is a functor not a monad. Being chainable is not overly important, as the functor law ensures that chained applications of fmap can be coalesced into a single one.
[ Parent
| on HN ]
I'd prefer to use the Maybe monad as an example of not being able to extract a value, as it's far clearer that sometimes there is no such value.
>Secondly the article says it needs a way to map a function over it. This is a functor not a monad.
Yes, but since monad is a superclass of functor, it's still a necessary property. Certainly, I'd much prefer it be taught in that order, but this is definitely a property you need to understand in order to form intuitions about monads.