[sledge] Simplify Equality.map_exps

Summary: Remove left-over complexity from previous versions.

Reviewed By: ngorogiannis

Differential Revision: D15468705

fbshipit-source-id: 316cda51b
master
Josh Berdine 6 years ago committed by Facebook Github Bot
parent c4707621ea
commit e391a8a9b2

@ -264,17 +264,15 @@ let or_ r s =
let map_exps ({sat= _; rep} as r) ~f = let map_exps ({sat= _; rep} as r) ~f =
[%Trace.call fun {pf} -> pf "%a" pp r] [%Trace.call fun {pf} -> pf "%a" pp r]
; ;
let map ~equal_key ~equal_data ~f_key ~f_data m = let map m =
Map.fold m ~init:m ~f:(fun ~key ~data m -> Map.fold m ~init:m ~f:(fun ~key ~data m ->
let key' = f_key key in let key' = f key in
let data' = f_data data in let data' = f data in
if equal_key key' key then if Exp.equal key' key then
if equal_data data' data then m else Map.set m ~key ~data:data' if Exp.equal data' data then m else Map.set m ~key ~data:data'
else Map.remove m key |> Map.add_exn ~key:key' ~data:data' ) else Map.remove m key |> Map.add_exn ~key:key' ~data:data' )
in in
let rep' = let rep' = map rep in
map rep ~equal_key:Exp.equal ~equal_data:Exp.equal ~f_key:f ~f_data:f
in
(if rep' == rep then r else {r with rep= rep'}) (if rep' == rep then r else {r with rep= rep'})
|> |>
[%Trace.retn fun {pf} r' -> [%Trace.retn fun {pf} r' ->

Loading…
Cancel
Save