Skip to content

Commit

Permalink
Merge pull request #286 from FissoreD/show_key_map
Browse files Browse the repository at this point in the history
[utils] add pp for map keys
  • Loading branch information
gares authored Nov 20, 2024
2 parents 72da262 + 2ab6b9e commit 00da01b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/API.mli
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,8 @@ module Utils : sig
module type S = sig
include Map.S
include Show1 with type 'a t := 'a t
val pp_key : Format.formatter -> key -> unit
val show_key : key -> string
end

module type OrderedType = sig
Expand Down
5 changes: 5 additions & 0 deletions src/utils/util.ml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ module Map = struct
module type S = sig
include Map.S
include Show1 with type 'a t := 'a t
val pp_key : Format.formatter -> key -> unit
val show_key : key -> string
end

module type OrderedType = sig
Expand All @@ -44,6 +46,9 @@ module Map = struct
pp f fmt m;
Format.fprintf fmt "@?";
Buffer.contents b

let pp_key = Ord.pp
let show_key = Ord.show
end

end
Expand Down
2 changes: 2 additions & 0 deletions src/utils/util.mli
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ module Map : sig
module type S = sig
include Map.S
include Show1 with type 'a t := 'a t
val pp_key : Format.formatter -> key -> unit
val show_key : key -> string
end

module type OrderedType = sig
Expand Down

0 comments on commit 00da01b

Please sign in to comment.