Browse Source

add infix module in Lwd

pull/1/head
Simon Cruanes 2 years ago
committed by Frédéric Bour
parent
commit
d641e4284f
  1. 6
      lib/lwd/lwd.ml
  2. 6
      lib/lwd/lwd.mli

6
lib/lwd/lwd.ml

@ -520,3 +520,9 @@ let set_on_invalidate x f =
match x with
| Pure _ | Impure _ | Operator _ -> assert false
| Root t -> t.on_invalidate <- f
module Infix = struct
let (>>=) = bind
let (>|=) = map'
let (<*>) = app
end

6
lib/lwd/lwd.mli

@ -112,3 +112,9 @@ val is_damaged : 'a root -> bool
val release : 'a root -> unit
(** Forget about this root and release sub-values no longer reachable from
any root. *)
module Infix : sig
val (>|=) : 'a t -> ('a -> 'b) -> 'b t
val (>>=) : 'a t -> ('a -> 'b t) -> 'b t
val (<*>) : ('a -> 'b) t -> 'a t -> 'b t
end

Loading…
Cancel
Save