package accessor

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

Of_monad is similar to Of_applicative. There are two differences.

Many functions generated by Of_monad can distinguish between `Sequential traversals and `Parallel traversals. This matters when you want to use monadic sequencing to control side effects. The functions generated by Of_applicative are only able to use the `Parallel behavior. Here are a couple examples of when you might care about this:

  • When using Or_error, map ~how:`Sequential t at ~f would terminate the traversal as soon as an error has occurs. map ~how:`Parallel t at ~f would apply f to everything before attempting to compose the results, and if there is more than one error they will be combined.
  • When using Deferred, map ~how:`Sequential t at ~f would wait for each deferred to become determined before moving on to the next value. map ~how:`Parallel at ~f would apply f to everything and then wait for the results to become determined asynchronously.

Parameters

module M : sig ... end

Signature

val map : ?how:[ `Parallel | `Sequential ] -> (Base.unit -> 'a -> 'b, Base.unit -> 'at -> 'bt, [> Subtyping.many ]) t -> 'at -> f:('a -> 'b M.t) -> 'bt M.t
val mapi : ?how:[ `Parallel | `Sequential ] -> ('i -> 'a -> 'b, Base.unit -> 'at -> 'bt, [> Subtyping.many ]) t -> 'at -> f:('i Index.t -> 'a -> 'b M.t) -> 'bt M.t
val all : (Base.unit -> 'a M.t -> 'a, Base.unit -> 'at -> 'bt, [> Subtyping.many ]) t -> 'at -> 'bt M.t
val all_unit : (Base.unit -> Base.unit M.t -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) t -> 'at -> Base.unit M.t
val iter : ?how:[ `Parallel | `Sequential ] -> (Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) t -> 'at -> f:('a -> Base.unit M.t) -> Base.unit M.t
val iteri : ?how:[ `Parallel | `Sequential ] -> ('i -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) t -> 'at -> f:('i Index.t -> 'a -> Base.unit M.t) -> Base.unit M.t
val sum : ?how:[ `Parallel | `Sequential ] -> (module Base.Container.Summable with type t = 'sum) -> (Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) t -> 'at -> f:('a -> 'sum M.t) -> 'sum M.t
val sumi : ?how:[ `Parallel | `Sequential ] -> (module Base.Container.Summable with type t = 'sum) -> ('i -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) t -> 'at -> f:('i Index.t -> 'a -> 'sum M.t) -> 'sum M.t
val count : ?how:[ `Parallel | `Sequential ] -> (Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) t -> 'at -> f:('a -> Base.bool M.t) -> Base.int M.t
val counti : ?how:[ `Parallel | `Sequential ] -> ('i -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) t -> 'at -> f:('i Index.t -> 'a -> Base.bool M.t) -> Base.int M.t
val map_reduce : ?how:[ `Parallel | `Sequential ] -> (Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) t -> 'at -> empty:'b -> combine:('b -> 'b -> 'b) -> f:('a -> 'b M.t) -> 'b M.t
val map_reducei : ?how:[ `Parallel | `Sequential ] -> ('i -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) t -> 'at -> empty:'b -> combine:('b -> 'b -> 'b) -> f:('i Index.t -> 'a -> 'b M.t) -> 'b M.t
val map_reduce_nonempty : ?how:[ `Parallel | `Sequential ] -> (Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.nonempty_getter ]) t -> 'at -> combine:('b -> 'b -> 'b) -> f:('a -> 'b M.t) -> 'b M.t
val map_reduce_nonemptyi : ?how:[ `Parallel | `Sequential ] -> ('i -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.nonempty_getter ]) t -> 'at -> combine:('b -> 'b -> 'b) -> f:('i Index.t -> 'a -> 'b M.t) -> 'b M.t
OCaml

Innovation. Community. Security.