Move definition of CCMap.update so that it is shadowed by Stdlib.Map.update

Signed-off-by: Josh Berdine <josh@berdine.net>
This commit is contained in:
Josh Berdine 2020-09-21 11:30:47 +01:00 committed by Simon Cruanes
parent d81cba4b06
commit e6f77edf1a

View file

@ -166,6 +166,15 @@ module Make(O : Map.OrderedType) = struct
| None -> raise Not_found
| Some (k,v) -> k, v
let update k f m =
let x =
try f (Some (M.find k m))
with Not_found -> f None
in
match x with
| None -> M.remove k m
| Some v' -> M.add k v' m
include M
let get = find_opt
@ -174,15 +183,6 @@ module Make(O : Map.OrderedType) = struct
try find k m
with Not_found -> default
let update k f m =
let x =
try f (Some (find k m))
with Not_found -> f None
in
match x with
| None -> remove k m
| Some v' -> add k v' m
let merge_safe ~f a b =
merge
(fun k v1 v2 -> match v1, v2 with