alg_structs

Interfaces and module combinators for algebraic structures
IN THIS PACKAGE
Module Alg_structs . Foldable . Law

Parameters

module F : S

Signature

val fold_right : ( 'a -> 'b -> 'b ) -> 'b -> 'a F.t -> bool

fold_right f init t is true when

F.fold_right ~f ~init t = (F.fold_map ~m ~f t) init

where init has type a and m is the Endo monoid over functions of type a -> a.

val fold_left : ( 'a -> 'a -> 'a ) -> 'a -> 'a F.t -> bool

fold_left f init t is true when

F.fold_right ~f ~init t = (F.fold_map ~m ~f:(Fun.flip f) t) init

where init has type a and m is the Dual of the Endo monoid over functions of type a -> a.

val fold : (module Monoid.S with type t = 'a) -> 'a F.t -> bool

fold (module M) t is true when

F.fold (module M) t = F.fold_map ~m:(module M) ~f:Fun.id t
val length : 'a F.t -> bool

length t is true when

F.length t = F.fold_map ~m ~f:(Fun.const 1) t

where m is Monoid.Int.Sum.