Commit 7c82402d authored by POTTIER Francois's avatar POTTIER Francois
Browse files

Update [KitBa] to use [disjoint_union_monoid].

parent fe9964e4
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
[IllFormed x] is raised if the atom [x] occurs twice in a binding [IllFormed x] is raised if the atom [x] occurs twice in a binding
position. *) position. *)
exception IllFormed of Atom.t exception IllFormed = Atom.Set.NonDisjointUnion
type env = unit type env = unit
...@@ -16,18 +16,8 @@ class ['self] reduce = object (_ : 'self) ...@@ -16,18 +16,8 @@ class ['self] reduce = object (_ : 'self)
method private visit_'fn () _x = method private visit_'fn () _x =
Atom.Set.empty Atom.Set.empty
(* TEMPORARY could move this monoid to [Atom] *)
(* The monoid of sets of atoms, equipped with disjoint union, is used. *) (* The monoid of sets of atoms, equipped with disjoint union, is used. *)
method zero = inherit [_] Atom.Set.disjoint_union_monoid
Atom.Set.empty
method plus xs ys =
match Atom.Set.choose (Atom.Set.inter xs ys) with
| exception Not_found ->
(* The intersection of [xs] and [ys] is empty; good.
Compute their disjoint union. *)
Atom.Set.union xs ys
| x ->
raise (IllFormed x)
(* The atom [x] is added to the set of bound atoms when its scope is (* The atom [x] is added to the set of bound atoms when its scope is
exited. *) exited. *)
......
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