EN
importPour l'utiliser : import Data.Foldable

Data.Foldable — opérations génériques sur n'importe quel Foldable

Synopsis
foldMap : Foldable t => Monoid m => (a -> m) -> t a -> m

Transforme chaque élément en un monoïde et les combine, de gauche à droite.

fold : Foldable t => Monoid m => t m -> m

Combine les éléments d'un foldable de monoïdes (fold = foldMap id).

toList : Foldable t => t a -> List a

Tous les éléments sous forme de liste, de gauche à droite.

null : Foldable t => t a -> Bool

Le foldable est-il vide ?

count : Foldable t => t a -> Nat

Le nombre d'éléments.

sum : Foldable t => Additive a => t a -> a

Somme des éléments (0 pour le foldable vide).

elem : Foldable t => Eq a => a -> t a -> Bool

Une valeur est-elle un élément ? (Le || paresseux court-circuite.)

any : Foldable t => (a -> Bool) -> t a -> Bool

Au moins un élément satisfait-il le prédicat ?

all : Foldable t => (a -> Bool) -> t a -> Bool

Tous les éléments satisfont-ils le prédicat ?

maximum : Foldable t => Ord a => t a -> Maybe a

Le plus grand élément, ou Nothing si vide (total).

minimum : Foldable t => Ord a => t a -> Maybe a

Le plus petit élément, ou Nothing si vide (total).