Module Indexed_foldable.Via_fold_map

Parameters

Signature

Type

type ('a, 'index) t = ('a, 'index) Req.t

The type held by the Indexable Foldable.

Functions

val fold_map' : 'a -> ('a -> 'a -> 'a) -> ('b -> 'a) -> ('b, 'index) t -> 'a

Map each element of the Foldable to a Monoid an combine the result.

val fold_right : ('a -> 'b -> 'b) -> ('a, 'index) t -> 'b -> 'b

Same of List.fold_right for Foldable.

val reduce : (module Preface_specs.Monoid.CORE with type t = 'm) -> ('m, 'index) t -> 'm

Reduce a Foldable using combine of the given monoid.

val fold_map : (module Preface_specs.Monoid.CORE with type t = 'm) -> ('a -> 'm) -> ('a, 'index) t -> 'm

Same of CORE.fold_map' but using a monoid module instead of giving explicitly neutral and combine.

val fold_left : ('a -> 'b -> 'a) -> 'a -> ('b, 'index) t -> 'a

Same of List.fold_left for Foldable.

val for_all : ('a -> bool) -> ('a, 'index) t -> bool

Checks if all elements of the Foldable satisfy the given predicate.

val exists : ('a -> bool) -> ('a, 'index) t -> bool

Checks if at least on element of the Foldable satisfy the given predicate.

val length : ('a, 'index) t -> int

Count the number of elements in the Foldable.