Commits

Sebastien Mondet committed adc0348

Deferred_list: add function `pick_and_cancel`

Comments (0)

Files changed (1)

 
 
 module type DEFERRED_LIST = sig
-(** Monadic “loops” on lists. *)
+(** Monadic “operations” on lists. *)
 
   (** Sequentially launch [f] on the first argument and
       get out of the loop at the first error.
   val for_concurrent_with_index:
     'a list -> f:(int -> 'a -> ('c, 'b) t) -> ('c list * 'b list, 'd) t
 
+  (** [pick_and_cancel] is a wrapper for [Lwt.pick]. *)
+  val pick_and_cancel: ('a, 'error) t list -> ('a, 'error) t
+
 end
 
 
     let with_indexes = List.mapi l ~f:(fun i a -> (i, a)) in
     for_concurrent with_indexes ~f:(fun (i, a) -> f i a)
 
+  let pick_and_cancel: ('a, 'error) t list -> ('a, 'error) t = fun l ->
+    Lwt.pick l
 
   end