diff --git a/src/fut.ml b/src/fut.ml index e04c7a13..34973022 100644 --- a/src/fut.ml +++ b/src/fut.ml @@ -143,6 +143,8 @@ let bind ?on ~f fut : _ t = fut2 +let join ?on fut = bind ?on fut ~f:(fun x -> x) + let update_ (st : 'a A.t) f : 'a = let rec loop () = let x = A.get st in diff --git a/src/fut.mli b/src/fut.mli index c5b635d3..ceee34e9 100644 --- a/src/fut.mli +++ b/src/fut.mli @@ -77,6 +77,10 @@ val bind : ?on:Pool.t -> f:('a -> 'b t) -> 'a t -> 'b t and fails with [e] if [fut] fails with [e] or [f x] raises [e]. @param on if provided, [f] runs on the given pool *) +val join : ?on:Pool.t -> 'a t t -> 'a t +(** [join fut] is [fut >>= Fun.id]. It joins the inner layer of the future. + @since 0.2 *) + val both : 'a t -> 'b t -> ('a * 'b) t (** [both a b] succeeds with [x, y] if [a] succeeds with [x] and [b] succeeds with [y], or fails if any of them fails. *)