From 89ce86eec09e86285bee5ef24cc1f9e0335f2388 Mon Sep 17 00:00:00 2001 From: Stavros Polymenis Date: Tue, 27 Mar 2018 23:05:34 +0100 Subject: [PATCH] Assert emptiness on both maps instead of raising custom exception. https://github.com/c-cube/ocaml-containers/pull/211\#pullrequestreview-107483136 --- src/data/CCBijection.ml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/data/CCBijection.ml b/src/data/CCBijection.ml index e3f5dfba..306d28c7 100644 --- a/src/data/CCBijection.ml +++ b/src/data/CCBijection.ml @@ -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 =