summaryrefslogtreecommitdiff
path: root/src/Identifiers.ml
diff options
context:
space:
mode:
authorSon Ho2021-11-29 23:46:20 +0100
committerSon Ho2021-11-29 23:46:20 +0100
commitac0bc7e011a93d955b5078e27f890e5a6916b412 (patch)
treecc50b9253c6d8623a67b71e03f1eee637f861213 /src/Identifiers.ml
parent2c7e19de3465c2ead68a4c851f2cc140d1542969 (diff)
Derive more debugging facilities
Diffstat (limited to '')
-rw-r--r--src/Identifiers.ml17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/Identifiers.ml b/src/Identifiers.ml
index e1684f2c..931ec97b 100644
--- a/src/Identifiers.ml
+++ b/src/Identifiers.ml
@@ -12,6 +12,8 @@ module type Id = sig
type 'a vector
+ type set_t
+
val zero : id
val generator_zero : generator
@@ -68,9 +70,13 @@ module type Id = sig
val exists : ('a -> bool) -> 'a vector -> bool
+ val pp_set_t : Format.formatter -> set_t -> unit
+
+ val show_set_t : set_t -> string
+
module Ord : Map.OrderedType with type t = id
- module Set : Set.S with type elt = id
+ module Set : Set.S with type elt = id with type t = set_t
val set_to_string : Set.t -> string
@@ -157,6 +163,15 @@ module IdGen () : Id = struct
module Set = Set.Make (Ord)
module Map = Map.Make (Ord)
+ type set_t = Set.t
+
+ let show_set_t s =
+ let ids = Set.fold (fun id s -> to_string id :: s) s [] in
+ let ids = List.rev ids in
+ "{" ^ String.concat "," ids ^ "}"
+
+ let pp_set_t fmt s = Format.pp_print_string fmt (show_set_t s)
+
let set_to_string ids =
let ids = Set.fold (fun id ids -> to_string id :: ids) ids [] in
"{" ^ String.concat ", " (List.rev ids) ^ "}"