From b5f0a3513c3706e843eedfd91f07f38017f19f1e Mon Sep 17 00:00:00 2001 From: David Allsopp Date: Wed, 8 Nov 2023 10:26:20 +0000 Subject: [PATCH] Fix 4.08/4.09 build --- src/core/opamCompat.ml | 12 ++++++++++++ src/core/opamCompat.mli | 5 +++++ 2 files changed, 17 insertions(+) diff --git a/src/core/opamCompat.ml b/src/core/opamCompat.ml index 216376563aa..773fee94590 100644 --- a/src/core/opamCompat.ml +++ b/src/core/opamCompat.ml @@ -147,3 +147,15 @@ Quoting commands for execution by cmd.exe is difficult. include Stdlib.Filename end + +module List = struct + [@@@warning "-32"] + + let concat_map f l = + let rec aux f acc = function + | [] -> List.rev acc + | x :: l -> + let xs = f x in + aux f (List.rev_append xs acc) l + in aux f [] l +end diff --git a/src/core/opamCompat.mli b/src/core/opamCompat.mli index 9596aedbb82..9846b4b7f14 100644 --- a/src/core/opamCompat.mli +++ b/src/core/opamCompat.mli @@ -38,3 +38,8 @@ module Filename: sig string -> ?stdin:string -> ?stdout:string -> ?stderr:string -> string list -> string end + +module List : sig + (* NOTE: OCaml >= 4.10 *) + val concat_map : ('a -> 'b list) -> 'a list -> 'b list +end