From 3ad4c06f4a2667c30f799cf78337a163e8b03088 Mon Sep 17 00:00:00 2001 From: Rudi Grinberg Date: Wed, 6 Jun 2018 13:28:14 +0700 Subject: [PATCH] Add Path.Table module Signed-off-by: Rudi Grinberg --- src/stdune/path.ml | 7 +++++++ src/stdune/path.mli | 1 + 2 files changed, 8 insertions(+) diff --git a/src/stdune/path.ml b/src/stdune/path.ml index 70124ffa..f7b7ee5e 100644 --- a/src/stdune/path.ml +++ b/src/stdune/path.ml @@ -489,6 +489,8 @@ module T : sig | In_build_dir of Local.t val compare : t -> t -> Ordering.t + val equal : t -> t -> bool + val hash : t -> int val in_build_dir : Local.t -> t val in_source_tree : Local.t -> t @@ -509,6 +511,9 @@ end = struct | _ , In_source_tree _ -> Gt | In_build_dir x , In_build_dir y -> Local.compare x y + let equal x y = compare x y = Ordering.Eq + let hash = Hashtbl.hash + let in_build_dir s = In_build_dir s let in_source_tree s = In_source_tree s let external_ e = External e @@ -904,3 +909,5 @@ module Set = struct end let in_source s = in_source_tree (Local.of_string s) + +module Table = Hashtbl.Make(T) diff --git a/src/stdune/path.mli b/src/stdune/path.mli index 0820b2fc..c7a691fe 100644 --- a/src/stdune/path.mli +++ b/src/stdune/path.mli @@ -37,6 +37,7 @@ module Set : sig end module Map : Map.S with type key = t +module Table : Hashtbl.S with type key = t val of_string : ?error_loc:Usexp.Loc.t -> string -> t val to_string : t -> string