fix(pool): missing emptiness check in Fut.map_l

also add regression test
This commit is contained in:
Simon Cruanes 2020-07-28 16:27:02 -04:00
parent 30b9307a70
commit 39e0ad2395

View file

@ -530,10 +530,18 @@ module Make(P : PARAM) = struct
(* reverse twice *)
let map_l f l =
match l with
| [] -> return []
| _ ->
let l = List.rev_map f l in
sequence_ (L_ l)
(fun () -> List.rev_map get_nolock_ l)
(*$=
[2;3] (Fut.get @@ Fut.map_l (fun x -> Fut.return (x+1)) [1;2])
[] (Fut.get @@ Fut.map_l (fun x -> Fut.return (x+1)) [])
*)
(*$R
let l = CCList.(1 -- 50) in
let l' = l