[sledge] Add Map.pp and use it for Var. and Equality.Subst.pp

Summary: Just a dedup refactoring.

Reviewed By: ngorogiannis

Differential Revision: D19282642

fbshipit-source-id: d050af84b
master
Josh Berdine 5 years ago committed by Facebook Github Bot
parent 66080d4b44
commit 5132a46c69

@ -239,6 +239,12 @@ end
module Map = struct
include Base.Map
let pp pp_k pp_v fs m =
Format.fprintf fs "@[<1>[%a]@]"
(List.pp ",@ " (fun fs (k, v) ->
Format.fprintf fs "@[%a @<2>↦ %a@]" pp_k k pp_v v ))
(to_alist m)
let equal_m__t (module Elt : Compare_m) equal_v = equal equal_v
let find_and_remove m k =

@ -180,6 +180,8 @@ end
module Map : sig
include module type of Base.Map
val pp : 'k pp -> 'v pp -> ('k, 'v, 'c) t pp
val equal_m__t :
(module Compare_m)
-> ('v -> 'v -> bool)

@ -361,12 +361,7 @@ module Var = struct
in
assert (Set.disjoint domain range)
let pp fs s =
Format.fprintf fs "@[<1>[%a]@]"
(List.pp ",@ " (fun fs (k, v) ->
Format.fprintf fs "@[%a ↦ %a@]" pp_t k pp_t v ))
(Map.to_alist s)
let pp = Map.pp pp_t pp_t
let empty = Map.empty
let is_empty = Map.is_empty

@ -41,11 +41,7 @@ module Subst : sig
end = struct
type t = Term.t Term.Map.t [@@deriving compare, equal, sexp]
let pp fs s =
Format.fprintf fs "@[<1>[%a]@]"
(List.pp ",@ " (fun fs (k, v) ->
Format.fprintf fs "@[%a ↦ %a@]" Term.pp k Term.pp v ))
(Map.to_alist s)
let pp = Map.pp Term.pp Term.pp
let pp_sdiff ?(pre = "") =
let pp_sdiff_elt pp_key pp_val pp_sdiff_val fs = function

Loading…
Cancel
Save