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