aboutsummaryrefslogtreecommitdiff
path: root/clib
diff options
context:
space:
mode:
authorGaëtan Gilbert2020-05-19 14:12:30 +0200
committerGaëtan Gilbert2020-05-19 14:12:30 +0200
commit407ca661d7eb33afed706afe74f11fccac2f1dd4 (patch)
treed867bc7f77bfeb1c9a09598f7945d7d77f1ccae3 /clib
parent2222e455f0501b700f198ab614d8743229062f73 (diff)
parent833d7672a4cc1dbdd4ab5a861362824b03f72d57 (diff)
Merge PR #12301: [declare] Grand unification of the proof save path.
Reviewed-by: SkySkimmer Ack-by: ppedrot
Diffstat (limited to 'clib')
-rw-r--r--clib/cSig.mli1
-rw-r--r--clib/hMap.ml4
2 files changed, 5 insertions, 0 deletions
diff --git a/clib/cSig.mli b/clib/cSig.mli
index ca888f875a..1305be42bd 100644
--- a/clib/cSig.mli
+++ b/clib/cSig.mli
@@ -83,6 +83,7 @@ sig
val min_binding: 'a t -> (key * 'a)
val max_binding: 'a t -> (key * 'a)
val choose: 'a t -> (key * 'a)
+ val choose_opt: 'a t -> (key * 'a) option
val split: key -> 'a t -> 'a t * 'a option * 'a t
val find: key -> 'a t -> 'a
val find_opt : key -> 'a t -> 'a option
diff --git a/clib/hMap.ml b/clib/hMap.ml
index 3baa105fb0..210c48786b 100644
--- a/clib/hMap.ml
+++ b/clib/hMap.ml
@@ -356,6 +356,10 @@ struct
let (_, m) = Int.Map.choose s in
Map.choose m
+ let choose_opt s =
+ try Some (choose s)
+ with Not_found -> None
+
let find k s =
let h = M.hash k in
let m = Int.Map.find h s in