Folds allow us to use perform iterative operations in Haskell without the need to use loops. We can fold from the left (foldl
) or fold from the right (foldr
).
A left fold is fairly simple to comprehend. A left fold takes the form
foldl func acc lst
where: