Skip to content

Commit

Permalink
use sequence instead of $
Browse files Browse the repository at this point in the history
  • Loading branch information
gpetiot committed Dec 9, 2020
1 parent 09277de commit 6584c4c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/Fmt.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down

0 comments on commit 6584c4c

Please sign in to comment.