mirror of
https://github.com/c-cube/ocaml-containers.git
synced 2025-12-06 11:15:31 -05:00
Assert emptiness on both maps instead of raising custom exception.
https://github.com/c-cube/ocaml-containers/pull/211\#pullrequestreview-107483136
This commit is contained in:
parent
712b12d2f1
commit
89ce86eec0
1 changed files with 4 additions and 3 deletions
|
|
@ -45,9 +45,10 @@ module Make(L : OrderedType)(R : OrderedType) = struct
|
|||
right = MapR.empty;
|
||||
}
|
||||
|
||||
let is_empty m = match MapL.is_empty m.left, MapR.is_empty m.right with
|
||||
| l, r when l = r -> l
|
||||
| l, r -> raise (Incoherence ("is_empty left: " ^ string_of_bool l ^ ", right: " ^ string_of_bool r))
|
||||
let is_empty m =
|
||||
let res = MapL.is_empty m.left in
|
||||
assert (res = MapR.is_empty m.right);
|
||||
res
|
||||
|
||||
let add a b m = {
|
||||
left =
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue