**Packages**- base
- containers

foldl, applied to a binary operator, a starting value (typically the left-identity of the operator), and a list, reduces the list using the binary operator, from left to right:
> foldl f z [x1, x2, ..., xn] == (...((z `f` x1) `f` x2) `f`...) `f` xn
The list must be finite.

foldl1 is a variant of foldl that has no starting value argument, and thus must be applied to non-empty lists.

foldr, applied to a binary operator, a starting value (typically the right-identity of the operator), and a list, reduces the list using the binary operator, from right to left:
> foldr f z [x1, x2, ..., xn] == x1 `f` (x2 `f` ... (xn `f` z)...)

foldr1 is a variant of foldr that has no starting value argument, and thus must be applied to non-empty lists.

A strict version of foldl.

Fold over the elements of a structure, associating to the left, but strictly.

A strict version of foldl1

Monadic fold over the elements of a structure, associating to the left, i.e. from left to right.

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
commutative.
> foldM f a1 [x1, x2, ..., xm]
==
> do
> a2 <- f a1 x1
> a3 <- f a2 x2
> ...
> f am xm
If right-to-left evaluation is required, the input list should be reversed.

Like foldM, but discards the result.

This function may be used as a value for Data.Foldable.foldMap in a Foldable instance.