diff --git a/bin/main.ml b/bin/main.ml index d8740065..baf23d22 100644 --- a/bin/main.ml +++ b/bin/main.ml @@ -1436,11 +1436,11 @@ let printenv = match Path.extract_build_context dir with | Some (ctx, _) -> let sctx = - String_map.find setup.scontexts ctx |> Option.value_exn + String.Map.find setup.scontexts ctx |> Option.value_exn in [dump sctx ~dir] | None -> - String_map.values setup.scontexts + String.Map.values setup.scontexts |> List.map ~f:(fun sctx -> let dir = Path.append (Super_context.context sctx).build_dir dir diff --git a/src/gen_rules.ml b/src/gen_rules.ml index 71387417..138718e5 100644 --- a/src/gen_rules.ml +++ b/src/gen_rules.ml @@ -794,6 +794,6 @@ let gen ~contexts ~build_system Fiber.parallel_map contexts ~f:make_sctx >>| fun l -> let map = String.Map.of_list_exn l in Build_system.set_rule_generators build_system - (String_map.map map ~f:(fun (module M : Gen) -> M.gen_rules)); - String_map.iter map ~f:(fun (module M : Gen) -> M.init ()); - String_map.map map ~f:(fun (module M : Gen) -> M.sctx) + (String.Map.map map ~f:(fun (module M : Gen) -> M.gen_rules)); + String.Map.iter map ~f:(fun (module M : Gen) -> M.init ()); + String.Map.map map ~f:(fun (module M : Gen) -> M.sctx) diff --git a/src/gen_rules.mli b/src/gen_rules.mli index 6b2475e8..26bb473d 100644 --- a/src/gen_rules.mli +++ b/src/gen_rules.mli @@ -7,4 +7,4 @@ val gen -> ?external_lib_deps_mode:bool (* default: false *) -> ?only_packages:Package.Name.Set.t -> Jbuild_load.conf - -> Super_context.t String_map.t Fiber.t + -> Super_context.t String.Map.t Fiber.t diff --git a/src/import.ml b/src/import.ml index 2972d36d..b78b4176 100644 --- a/src/import.ml +++ b/src/import.ml @@ -9,15 +9,6 @@ let ksprintf = Printf.ksprintf let initial_cwd = Sys.getcwd () -module String_map = struct - include String.Map - - let pp f fmt t = - Format.pp_print_list (fun fmt (k, v) -> - Format.fprintf fmt "@[(%s@ =@ %a)@]" k f v - ) fmt (to_list t) -end - module Sys = struct include Sys diff --git a/src/main.ml b/src/main.ml index 9a1ee474..9488cb62 100644 --- a/src/main.ml +++ b/src/main.ml @@ -6,7 +6,7 @@ let () = Inline_tests.linkme type setup = { build_system : Build_system.t ; contexts : Context.t list - ; scontexts : Super_context.t String_map.t + ; scontexts : Super_context.t String.Map.t ; packages : Package.t Package.Name.Map.t ; file_tree : File_tree.t ; env : Env.t diff --git a/src/main.mli b/src/main.mli index 2bff6479..a7cfbc8b 100644 --- a/src/main.mli +++ b/src/main.mli @@ -3,7 +3,7 @@ open! Import type setup = { build_system : Build_system.t ; contexts : Context.t list - ; scontexts : Super_context.t String_map.t + ; scontexts : Super_context.t String.Map.t ; packages : Package.t Package.Name.Map.t ; file_tree : File_tree.t ; env : Env.t diff --git a/src/meta.ml b/src/meta.ml index b9f57635..fe7713f5 100644 --- a/src/meta.ml +++ b/src/meta.ml @@ -141,7 +141,7 @@ module Simplified = struct let rec pp fmt t = Fmt.record fmt [ "name", Fmt.const Fmt.quoted t.name - ; "vars", Fmt.const (String_map.pp Rules.pp) t.vars + ; "vars", Fmt.const (String.Map.pp Rules.pp) t.vars ; "subs", Fmt.const (Fmt.ocaml_list pp) t.subs ] end diff --git a/src/stdune/string.ml b/src/stdune/string.ml index 3bb7f50e..e75da57f 100644 --- a/src/stdune/string.ml +++ b/src/stdune/string.ml @@ -202,7 +202,13 @@ let maybe_quoted s = Printf.sprintf {|"%s"|} escaped module Set = Set.Make(T) -module Map = Map.Make(T) +module Map = struct + include Map.Make(T) + let pp f fmt t = + Format.pp_print_list (fun fmt (k, v) -> + Format.fprintf fmt "@[(%s@ =@ %a)@]" k f v + ) fmt (to_list t) +end module Table = Hashtbl.Make(T) let enumerate_gen s = diff --git a/src/stdune/string.mli b/src/stdune/string.mli index 54818776..a21c574f 100644 --- a/src/stdune/string.mli +++ b/src/stdune/string.mli @@ -52,5 +52,9 @@ val enumerate_and : string list -> string val enumerate_or : string list -> string module Set : Set.S with type elt = t -module Map : Map.S with type key = t +module Map : sig + include Map.S with type key = t + + val pp : (Format.formatter -> 'a -> unit) -> Format.formatter -> 'a t -> unit +end module Table : Hashtbl.S with type key = t diff --git a/test/unit-tests/tests.mlt b/test/unit-tests/tests.mlt index 76c2cb1d..2a913255 100644 --- a/test/unit-tests/tests.mlt +++ b/test/unit-tests/tests.mlt @@ -15,7 +15,7 @@ let print_pkg ppf pkg = ;; #install_printer print_pkg;; -#install_printer String_map.pp;; +#install_printer String.Map.pp;; [%%expect{| val print_pkg : Format.formatter -> Findlib.Package.t -> unit =