Remove String_map module

We can just use String.Map

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
This commit is contained in:
Rudi Grinberg 2018-08-01 11:59:33 +02:00
parent d6c2a434db
commit 6e29bd10ef
10 changed files with 22 additions and 21 deletions

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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 "@[<hov 2>(%s@ =@ %a)@]" k f v
) fmt (to_list t)
end
module Sys = struct
include Sys

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 "@[<hov 2>(%s@ =@ %a)@]" k f v
) fmt (to_list t)
end
module Table = Hashtbl.Make(T)
let enumerate_gen s =

View File

@ -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

View File

@ -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 = <fun>