Foldables
Foldables are type constructors of the * -> *
kind that represent collections of elements and come equipped with particular functionality.
The Foldable type class
The functionality that should be provided by a foldable is captured in the Foldable
type class. This type class is a so-called type constructor class because it ranges over t
type constructors rather than proper types:
Data.Foldable
class Foldable t where
fold :: Monoid m => t m -> m
foldMap :: Monoid m => (a -> m) -> t a -> m
foldMap' :: Monoid m => (a -> m) -> t a -> m
foldr :: (a -> b -> b) -> b -> t a -> b
foldr' :: (a -> b -> b) -> b -> t a -> b
foldl :: (b -> a -> b) -> b -> t a -> b
foldl' :: (b -> a ...