Express MakePPMonoMap in terms of MakePPMap

Reviewed By: skcho

Differential Revision: D14243587

fbshipit-source-id: 12aa08147
master
Mehdi Bouaziz 6 years ago committed by Facebook Github Bot
parent cc1e18e124
commit 5add974242

@ -170,26 +170,15 @@ module type PPMonoMap = sig
val pp_key : F.formatter -> key -> unit val pp_key : F.formatter -> key -> unit
end end
module MakePPMonoMap (Ord : PrintableOrderedType) (Val : PrintableType) = struct module PPMonoMapOfPPMap (M : PPMap) (Val : PrintableType) = struct
module M = Caml.Map.Make (Ord) include (M : module type of M with type key = M.key and type 'a t := 'a M.t)
include (M : module type of M with type 'a t := 'a M.t)
type t = Val.t M.t type t = Val.t M.t
type value = Val.t type value = Val.t
let pp_key = Ord.pp let pp = pp ~pp_value:Val.pp
let pp fmt m =
let pp_item fmt (k, v) = F.fprintf fmt "%a -> %a" Ord.pp k Val.pp v in
pp_collection ~pp_item fmt (bindings m)
let is_singleton_or_more m =
if is_empty m then IContainer.Empty
else
let ((kmi, _) as binding) = min_binding m in
let kma, _ = max_binding m in
if phys_equal kmi kma then IContainer.Singleton binding else IContainer.More
end end
module MakePPMonoMap (Ord : PrintableOrderedType) (Val : PrintableType) =
PPMonoMapOfPPMap (MakePPMap (Ord)) (Val)

Loading…
Cancel
Save