package core

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Core.ContainerSource

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 module type of struct include Base.Container end
Sourcemodule Continue_or_stop = Base.Container.Continue_or_stop

Continue_or_stop.t is used by the f argument to fold_until in order to indicate whether folding should continue, or stop early.

Sourcemodule type S0 = Base.Container.S0
Sourcemodule type S0_phantom = Base.Container.S0_phantom
Sourcemodule type S0_with_creators = Base.Container.S0_with_creators
Sourcemodule type S1 = Base.Container.S1
Sourcemodule type S1_phantom = Base.Container.S1_phantom
Sourcemodule type S1_with_creators = Base.Container.S1_with_creators
Sourcemodule type Derived = Base.Container.Derived
Sourcemodule type Generic = Base.Container.Generic
Sourcemodule type Generic_with_creators = Base.Container.Generic_with_creators
Sourcemodule type Summable = Base.Container.Summable
include Derived
Sourcetype ('t, 'a, 'acc) fold = 't -> init:'acc -> f:('acc -> 'a -> 'acc) -> 'acc
Sourcetype ('t, 'a) iter = 't -> f:('a -> unit) -> unit
Sourcetype 't length = 't -> int
Sourceval iter : fold:('t, 'a, unit) fold -> ('t, 'a) iter
Sourceval count : fold:('t, 'a, int) fold -> 't -> f:('a -> bool) -> int
Sourceval min_elt : fold:('t, 'a, 'a option) fold -> 't -> compare:('a -> 'a -> int) -> 'a option
Sourceval max_elt : fold:('t, 'a, 'a option) fold -> 't -> compare:('a -> 'a -> int) -> 'a option
Sourceval length : fold:('t, _, int) fold -> 't -> int
Sourceval to_list : fold:('t, 'a, 'a list) fold -> 't -> 'a list
Sourceval sum : fold:('t, 'a, 'sum) fold -> (module Base.Container.Summable with type t = 'sum) -> 't -> f:('a -> 'sum) -> 'sum
Sourceval fold_result : fold:('t, 'a, 'acc) fold -> init:'acc -> f:('acc -> 'a -> ('acc, 'e) Base.Result.t) -> 't -> ('acc, 'e) Base.Result.t
Sourceval fold_until : fold:('t, 'a, 'acc) fold -> init:'acc -> f:('acc -> 'a -> ('acc, 'final) Base.Container.Continue_or_stop.t) -> finish:('acc -> 'final) -> 't -> 'final

Generic definitions of container operations in terms of iter and length.

Sourceval is_empty : iter:('t, 'a) iter -> 't -> bool
Sourceval mem : iter:('t, 'a) iter -> 't -> 'a -> equal:('a -> 'a -> bool) -> bool
Sourceval exists : iter:('t, 'a) iter -> 't -> f:('a -> bool) -> bool
Sourceval for_all : iter:('t, 'a) iter -> 't -> f:('a -> bool) -> bool
Sourceval find : iter:('t, 'a) iter -> 't -> f:('a -> bool) -> 'a option
Sourceval find_map : iter:('t, 'a) iter -> 't -> f:('a -> 'b option) -> 'b option
Sourceval to_array : length:'t length -> iter:('t, 'a) iter -> 't -> 'a array

The idiom for using Container.Make is to bind the resulting module and to explicitly import each of the functions that one wants:

Sourcemodule Make_with_creators = Base.Container.Make_with_creators
Sourcemodule Make0_with_creators = Base.Container.Make0_with_creators
Sourcemodule Make_gen_with_creators = Base.Container.Make_gen_with_creators
Sourcemodule type S0_permissions = Container_intf.S0_permissions
Sourcemodule type S1_permissions = Container_intf.S1_permissions
Sourcemodule type S1_with_creators_permissions = Container_intf.S1_with_creators_permissions
OCaml

Innovation. Community. Security.