|
|
|
|
|
by mattnewport
1476 days ago
|
|
Is Maybe/Option an effectful computation? Is List? I don't think it's really accurate to say this is what monads are "for". It's one use for monads but monads aren't "for" anything and there are monads that are not about effects. |
|
There's a name for the monad in which there is no effect: the identity monad.
The heart of a monad is the bind/flatMap/and_then interface, in which the value contained in the monad is computed on to produce a new monadic value. This is where the effect occurs: something other than just running the function happens.
If the bind implementation only runs the provided function then there's no effect, and it's the identity monad.