Foldable package:compdata

The Foldable class represents data structures that can be reduced to a summary value one element at a time. Strict left-associative folds are a good fit for space-efficient reduction, while lazy right-associative folds are a good fit for corecursive iteration, or for folds that short-circuit after processing an initial subsequence of the structure's elements. Instances can be derived automatically by enabling the DeriveFoldable extension. For example, a derived instance for a binary tree might be:
{-# LANGUAGE DeriveFoldable #-}
data Tree a = Empty
| Leaf a
| Node (Tree a) a (Tree a)
deriving Foldable
A more detailed description can be found in the Overview section of Data.Foldable#overview. For the class laws see the Laws section of Data.Foldable#laws.
Derive an instance of Foldable for a type constructor of any first-order kind taking at least one argument.
Higher-order functors that can be folded. Minimal complete definition: hfoldMap or hfoldr.
Derive an instance of HFoldable for a type constructor of any higher-order kind taking at least two arguments.
This module defines higher-order foldable functors.