mirror of
https://github.com/c-cube/moonpool.git
synced 2025-12-06 03:05:30 -05:00
feat fut: add join
This commit is contained in:
parent
0177d6aee7
commit
7c853861d8
2 changed files with 6 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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. *)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue