mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
fix(pool): missing emptiness check in Fut.map_l
also add regression test
This commit is contained in:
parent
30b9307a70
commit
39e0ad2395
1 changed files with 11 additions and 3 deletions
|
|
@ -530,9 +530,17 @@ module Make(P : PARAM) = struct
|
||||||
|
|
||||||
(* reverse twice *)
|
(* reverse twice *)
|
||||||
let map_l f l =
|
let map_l f l =
|
||||||
let l = List.rev_map f l in
|
match l with
|
||||||
sequence_ (L_ l)
|
| [] -> return []
|
||||||
(fun () -> List.rev_map get_nolock_ l)
|
| _ ->
|
||||||
|
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
|
(*$R
|
||||||
let l = CCList.(1 -- 50) in
|
let l = CCList.(1 -- 50) in
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue