From 6584c4c031b6e59f1dd020f0413a60b1af7ee05e Mon Sep 17 00:00:00 2001 From: Guillaume Petiot Date: Wed, 9 Dec 2020 21:52:51 +0700 Subject: [PATCH] use sequence instead of $ --- lib/Fmt.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/Fmt.ml b/lib/Fmt.ml index f8af3bfe7f..09974bda5b 100644 --- a/lib/Fmt.ml +++ b/lib/Fmt.ml @@ -139,15 +139,16 @@ let list_pn x1N pp = | x1 :: (x2 :: _ as x2N) -> let l = let rec aux (prev, acc) = function - | [] -> List.rev acc + | [] -> acc | [xI] -> aux (xI, (Some prev, xI, None) :: acc) [] | xI :: (xJ :: _ as xJN) -> aux (xI, (Some prev, xI, Some xJ) :: acc) xJN in aux (x1, [(None, x1, Some x2)]) x2N in - List.fold_left l ~init:noop ~f:(fun acc (prev, x, next) -> - acc $ lazy_ (fun () -> pp ~prev x ~next) ) + List.rev_map l ~f:(fun (prev, x, next) -> + lazy_ (fun () -> pp ~prev x ~next) ) + |> sequence let list_fl xs pp = list_pn xs (fun ~prev x ~next ->