6 ms·
I think you describe only a Functor, not a Monad. A Monad also has to have either a `bind` or a `flatmap` function, besides the `(f)map`. Basically the point o
by kaba0 5y ago
I think you describe only a Functor, not a Monad. A Monad also has to have either a `bind` or a `flatmap` function, besides the `(f)map`.
Basically the point of a monad is to depend on the output of another monad data type of its kind — e.g. it can take an IO String and use the encapsulated String value to produce another IO X. This would be IO (IO X) without the flatmap, or the bind function that can remove this double encapsulation.
- duped 5y agoThis is what I was attempting to describe. `bind` is implicit, it's the constructor of a monad. In my definition `map` is serving the purpose of your flatmap, I didn't mean to imply double encapsulation.