Array.Ops_monad
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 mlift : ('a -> 'b) -> '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
m >>= do_if cond f
is equiv. to m >>= do_cond cond f (returning ())
monadic binding version of sequence_list