Provides generic signatures for container data structures.
These signatures include functions (iter
, fold
, exists
, for_all
, ...) that you
would expect to find in any container. Used by including Container.S0
or
Container.S1
in the signature for every container-like data structure (Array
,
List
, String
, ...) to ensure a consistent interface.
These signatures extend signatures exported by Base.Container_intf.
include Base.Container_intf.Container
module type S0 = Base.Container_intf.S0
module type S0_phantom = Base.Container_intf.S0_phantom
module type S1 = Base.Container_intf.S1
module type S1_phantom_invariant = Base.Container_intf.S1_phantom_invariant
module type S1_phantom = Base.Container_intf.S1_phantom
module type Generic = Base.Container_intf.Generic
module type Generic_phantom = Base.Container_intf.Generic_phantom
Generic definitions of container operations in terms of fold
.
E.g.: iter ~fold t ~f = fold t ~init:() ~f:(fun () a -> f a)
.
val count : fold:('t, 'a, int) fold ‑> 't ‑> f:('a ‑> bool) ‑> int
val min_elt : fold:('t, 'a, 'a option) fold ‑> 't ‑> cmp:('a ‑> 'a ‑> int) ‑> 'a option
val max_elt : fold:('t, 'a, 'a option) fold ‑> 't ‑> cmp:('a ‑> 'a ‑> int) ‑> 'a option
val length : fold:('t, _, int) fold ‑> 't ‑> int
val to_list : fold:('t, 'a, 'a list) fold ‑> 't ‑> 'a list
val to_array : fold:('t, 'a, 'a list) fold ‑> 't ‑> 'a array
val sum : fold:('t, 'a, 'sum) fold ‑> (module Base.Commutative_group.S with type t = 'sum) ‑> 't ‑> f:('a ‑> 'sum) ‑> 'sum
val fold_result : fold:('t, 'a, 'b) fold ‑> init:'b ‑> f:('b ‑> 'a ‑> ('b, 'e) Base.Result.t) ‑> 't ‑> ('b, 'e) Base.Result.t
val fold_until : fold:('t, 'a, 'b) fold ‑> init:'b ‑> f:('b ‑> 'a ‑> ('b, 'stop) Base.Container_intf.Continue_or_stop.t) ‑> 't ‑> ('b, 'stop) Base.Container_intf.Finished_or_stopped_early.t
val is_empty : iter:('t, 'a) iter ‑> 't ‑> bool
Generic definitions of container operations in terms of iter
.
val exists : iter:('t, 'a) iter ‑> 't ‑> f:('a ‑> bool) ‑> bool
val for_all : iter:('t, 'a) iter ‑> 't ‑> f:('a ‑> bool) ‑> bool
val find : iter:('t, 'a) iter ‑> 't ‑> f:('a ‑> bool) ‑> 'a option
val find_map : iter:('t, 'a) iter ‑> 't ‑> f:('a ‑> 'b option) ‑> 'b option
module type S1_permissions = Core_kernel.Container_intf.S1_permissions