- Lists are not the only foldable data structures.
- Folding function is always dependent on some Monoid instance.
Generalizing catamorphisms to other datatypes depends on understanding monoids for other structures and in some cases, making them explicit
class Foldable (t :: * -> *) where
{-# MINIMAL foldMap | foldr #-}
fold :: Monoid m => t m => m
foldMap :: Monoid m => (a -> m) -> t a -> m
- Folding necessarily implies a binary associative operation that has an identity value.