Core_kernel.ContainerProvides 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 module type of struct include Base.Container endmodule Continue_or_stop : sig ... endContinue_or_stop.t is used by the f argument to fold_until in order to indicate whether folding should continue, or stop early.
module type S0 = sig ... endmodule type S0_phantom = sig ... endmodule type S1 = sig ... endmodule type S1_phantom_invariant = sig ... endmodule type S1_phantom = sig ... endmodule type Generic = sig ... endmodule type Generic_phantom = sig ... endmodule type Summable = sig ... endGeneric 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) -> intval min_elt : fold:('t, 'a, 'a option) fold -> 't -> compare:('a -> 'a -> int) ->
'a optionval max_elt : fold:('t, 'a, 'a option) fold -> 't -> compare:('a -> 'a -> int) ->
'a optionval length : fold:('t, _, int) fold -> 't -> intval to_list : fold:('t, 'a, 'a list) fold -> 't -> 'a listval fold_result : fold:('t, 'a, 'b) fold -> init:'b -> f:('b -> 'a -> ('b, 'e) Base.Result.t) ->
't -> ('b, 'e) Base.Result.tval fold_until : fold:('t, 'a, 'b) fold -> init:'b -> f:('b -> 'a -> ('b, 'final) Continue_or_stop.t) ->
finish:('b -> 'final) -> 't -> 'finalval is_empty : iter:('t, 'a) iter -> 't -> boolGeneric definitions of container operations in terms of iter and length.
val exists : iter:('t, 'a) iter -> 't -> f:('a -> bool) -> boolval for_all : iter:('t, 'a) iter -> 't -> f:('a -> bool) -> boolval find : iter:('t, 'a) iter -> 't -> f:('a -> bool) -> 'a optionval find_map : iter:('t, 'a) iter -> 't -> f:('a -> 'b option) -> 'b optionThe idiom for using Container.Make is to bind the resulting module and to explicitly import each of the functions that one wants:
module type S1_permissions = Container_intf.S1_permissions