From 5017c22b33d1bf508936d1bba5d57e40d904a227 Mon Sep 17 00:00:00 2001 From: Etienne Millon Date: Tue, 16 Jun 2020 16:38:57 +0200 Subject: [PATCH] Use tail-recursive List.map This prevents some stack overflows with large documents. See ocaml/dune#3537. Signed-off-by: Etienne Millon --- src/pp.ml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/pp.ml b/src/pp.ml index a8398d7..ee0f34e 100644 --- a/src/pp.ml +++ b/src/pp.ml @@ -1,4 +1,9 @@ -module List = ListLabels +module List = struct + include ListLabels + + let map ~f t = rev (rev_map ~f t) +end + module String = StringLabels type +'a t =