Monad m => (a -> b -> m c) -> m a -> m b -> m c
The foldM function is analogous to foldl, except that its result is encapsulated in a monad. Note that foldM works from left-to-right over the list arguments. This could be an issue
> foldM f a1 [x1, x2, ..., xm]
> a2 <- f a1 x1
> a3 <- f a2 x2
> f am xm
If right-to-left evaluation is required, the input list should be reversed.
Monadic fold over the elements of a structure, associating to the left, i.e. from left to right.
Like foldM, but discards the result.
Monadic fold over the elements of a structure, associating to the right, i.e. from right to left.
| +--(2,()) | +--(1,()) </pre>