Module Accessor.Of_monad
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 ~fwould terminate the traversal as soon as an error has occurs.map ~how:`Parallel t at ~fwould applyfto 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 ~fwould wait for each deferred to become determined before moving on to the next value.map ~how:`Parallel at ~fwould applyfto everything and then wait for the results to become determined asynchronously.
Parameters
M : sig ... end
Signature
include Accessor__.Applicative_signatures_intf.Monad_s2 with type ('a, _) t := 'a t
val map : ((Base.unit -> 'a -> 'b, Base.unit -> 'at -> 'bt, [> Subtyping.many ]) accessor -> 'at -> f:('a -> ('b, 'e) t) -> ('bt, 'e) t) optional_argsval mapi : (('i -> 'a -> 'b, Base.unit -> 'at -> 'bt, [> Subtyping.many ]) accessor -> 'at -> f:('i Index.t -> 'a -> ('b, 'e) t) -> ('bt, 'e) t) optional_argsval all : (Base.unit -> ('a, 'e) t -> 'a, Base.unit -> 'at -> 'bt, [> Subtyping.many ]) accessor -> 'at -> ('bt, 'e) tval all_unit : (Base.unit -> (Base.unit, 'e) t -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) accessor -> 'at -> (Base.unit, 'e) tval iter : ((Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) accessor -> 'at -> f:('a -> (Base.unit, 'e) t) -> (Base.unit, 'e) t) optional_argsval iteri : (('i -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) accessor -> 'at -> f:('i Index.t -> 'a -> (Base.unit, 'e) t) -> (Base.unit, 'e) t) optional_argsval sum : ((module Base.Container.Summable with type t = 'sum) -> (Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) accessor -> 'at -> f:('a -> ('sum, 'e) t) -> ('sum, 'e) t) optional_argsval sumi : ((module Base.Container.Summable with type t = 'sum) -> ('i -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) accessor -> 'at -> f:('i Index.t -> 'a -> ('sum, 'e) t) -> ('sum, 'e) t) optional_argsval count : ((Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) accessor -> 'at -> f:('a -> (Base.bool, 'e) t) -> (Base.int, 'e) t) optional_argsval counti : (('i -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) accessor -> 'at -> f:('i Index.t -> 'a -> (Base.bool, 'e) t) -> (Base.int, 'e) t) optional_argsval map_reduce : ((Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) accessor -> 'at -> empty:'b -> combine:('b -> 'b -> 'b) -> f:('a -> ('b, 'e) t) -> ('b, 'e) t) optional_argsval map_reducei : (('i -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.many_getter ]) accessor -> 'at -> empty:'b -> combine:('b -> 'b -> 'b) -> f:('i Index.t -> 'a -> ('b, 'e) t) -> ('b, 'e) t) optional_argsval map_reduce_nonempty : ((Base.unit -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.nonempty_getter ]) accessor -> 'at -> combine:('b -> 'b -> 'b) -> f:('a -> ('b, 'e) t) -> ('b, 'e) t) optional_argsval map_reduce_nonemptyi : (('i -> 'a -> _, Base.unit -> 'at -> _, [> Subtyping.nonempty_getter ]) accessor -> 'at -> combine:('b -> 'b -> 'b) -> f:('i Index.t -> 'a -> ('b, 'e) t) -> ('b, 'e) t) optional_args