Commit 3012ceb1 authored by POTTIER Francois's avatar POTTIER Francois

Add [handle_NonDisjointUnion].

parent 2e871443
...@@ -152,6 +152,13 @@ module Set = struct ...@@ -152,6 +152,13 @@ module Set = struct
(* The intersection contains [x]. Raise an exception. *) (* The intersection contains [x]. Raise an exception. *)
raise (NonDisjointUnion x) raise (NonDisjointUnion x)
let handle_NonDisjointUnion f x =
try
f x; true
with NonDisjointUnion a ->
Printf.eprintf "NonDisjointUnion: %s\n%!" (show a);
false
(* Sets of atoms form a monoid under union. *) (* Sets of atoms form a monoid under union. *)
class ['z] union_monoid = object class ['z] union_monoid = object
......
...@@ -33,6 +33,8 @@ module Set : sig ...@@ -33,6 +33,8 @@ module Set : sig
exception NonDisjointUnion of atom exception NonDisjointUnion of atom
val disjoint_union: t -> t -> t val disjoint_union: t -> t -> t
val handle_NonDisjointUnion: ('a -> 'b) -> 'a -> bool
(* Sets of atoms form monoids under union and disjoint union. *) (* Sets of atoms form monoids under union and disjoint union. *)
class ['z] union_monoid : object class ['z] union_monoid : object
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment