Module Array.Ops

include module type of Ops_monad
include Monadic with type 'x t := 'x t
val return : 'x -> 'x t
val bind : 'x t -> ('x -> 'y t) -> 'y t
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t

monadic binding

val (>>) : 'x t -> 'y t -> 'y t

monadic sequencing

NB if expr1 and expr2 both incur side effects, expr1 >> expr2 will usually incur side effects of expr2 first and then expr1, which is usually not what the programmer expects

val (>|=) : 'x t -> ('x -> 'y) -> 'y t

monadic mapping

val returning : 'a -> 'b -> 'a t

monadic version of constant

val mlift : ('a -> 'b) -> 'a -> 'b t
val mwrap : ('a -> 'b) -> 'a t -> 'b t
val do_cond : bool -> ('a -> 'b t) -> ('a -> 'b t) -> 'a -> 'b t

m >>= do_cond cond f_true f_false performs f_true or f_false on value enclosed in m, respectively when cond is true or false;

functionally equiv. to fun c f1 f2 -> if c then f1 else f2 but return type of f1 and f2 is restricted to _ t

val do_if : bool -> ('a -> unit t) -> 'a -> unit t

m >>= do_if cond f is equiv. to m >>= do_cond cond f (returning ())

val sequence_list : 'a t list -> 'a list t
val (>>=*) : 'x t list -> ('x list -> 'y t) -> 'y t

monadic binding version of sequence_list

include module type of Ops_piping
val (|&>) : 'x t -> ('x -> 'y) -> 'y t

piping map

val (|&>>) : 'x t -> ('x -> 'y t) -> 'y t

piping flat-map

val (|+&>) : 'x t -> ('x -> 'y) -> ('x * 'y) t

piping map to snd

val (|!>) : 'x t -> ('x -> unit) -> unit

piping iter

val (|-!>) : 'x t -> ('x -> unit) -> 'x t

piping and iter-tapping

val (|@>) : 'x t -> ('acc * (('acc * 'x) -> 'acc)) -> 'acc

piping fold_left

val (|?>) : 'x t -> ('x -> bool) -> 'x t

piping filter

val (|&?>) : 'x t -> ('x -> 'y option) -> 'y t

piping filter map

val (|+&?>) : 'x t -> ('x -> 'y option) -> ('x * 'y) t

piping filter map to snd