Module type Foldable.S

The complete module signature for Foldable for types with a single type variable.

type 'a t

A data structure which can be folded

val fold_left : f:('b -> 'a -> 'b) -> init:'b -> 'a t -> 'b

Left associative fold of a data structure; this is the same as the function derived from [@@deriving fold] but with labelled arguments

val fold_right : f:('a -> 'b -> 'b) -> init:'b -> 'a t -> 'b

Right associative fold of a data structure

val any : pred:('a -> bool) -> ?init:bool -> 'a t -> bool

Test whether any element of the data structure satisfies the supplied predicate. The optional argument init specifies the starting value and defaults to false.

val all : pred:('a -> bool) -> ?init:bool -> 'a t -> bool

Test whether all elements of the the data structure satify the supplied predicate. The optional argument init specifies the starting value and defaults to true.