Class of data structures that can be folded to a summary value.Methods:
fold : Monoidm => tm -> m
Combine the elements of a structure using a monoid.
foldMap : Monoidm => (a -> m) -> ta -> m
Combine the elements of a structure using a monoid.
foldr : (a -> b -> b) -> b -> ta -> b
Right-associative fold of a structure.
foldl : (b -> a -> b) -> b -> ta -> b
Left-associative fold of a structure.
foldr1 : (a -> a -> a) -> ta -> a
A variant of foldr that has no base case, and thus should only be applied to non-empty structures.
foldl1 : (a -> a -> a) -> ta -> a
A variant of foldl that has no base case, and thus should only be applied to non-empty structures.
toList : ta -> [a]
List of elements of a structure, from left to right.
null : ta -> Bool
Test whether the structure is empty. The default implementation is optimized for structures that are similar to cons-lists, because there is no general way to do better.
length : ta -> Int
Returns the size/length of a finite structure as an Int. The default implementation is optimized for structures that are similar to cons-lists, because there is no general way to do better.
elem : Eqa => a -> ta -> Bool
Does the element occur in the structure?
sum : Additivea => ta -> a
The sum function computes the sum of the numbers of a structure.
product : Multiplicativea => ta -> a
The product function computes the product of the numbers of a structure.
minimum : Orda => ta -> a
The least element of a non-empty structure.
maximum : Orda => ta -> a
The largest element of a non-empty structure.
mapA_ : (Foldablet, Applicativef) => (a -> fb) -> ta -> f ()Map each element of a structure to an action, evaluate these
actions from left to right, and ignore the results. For a version
that doesn’t ignore the results see ‘DA.Traversable.mapA’.
forA_ : (Foldablet, Applicativef) => ta -> (a -> fb) -> f ()‘for_’ is ‘mapA_’ with its arguments flipped. For a version
that doesn’t ignore the results see ‘DA.Traversable.forA’.
sequence_ : (Foldablet, Actionm) => t (ma) -> m ()Evaluate each action in the structure from left to right,
and ignore the results. For a version that doesn’t ignore the
results see ‘DA.Traversable.sequence’.
and : Foldablet => tBool -> Booland returns the conjunction of a container of Bools. For the result to be True, the container must be finite; False, however, results from a False value finitely far from the left end.
or : Foldablet => tBool -> Boolor returns the disjunction of a container of Bools. For the result to be False, the container must be finite; True, however, results from a True value finitely far from the left end.