Monads and Functors
For compatibility with Haskell. Note that monads are not free to
define return
and pure
differently!
Similar to foldl
, but uses a function wrapping its result in a Monad
.
Consequently, the final value is wrapped in the same Monad
.