diff options
Diffstat (limited to 'lib/kernel')
| -rw-r--r-- | lib/kernel/EphemeralRelation.ml | 9 | ||||
| -rw-r--r-- | lib/kernel/Multigroup.ml | 8 |
2 files changed, 4 insertions, 13 deletions
diff --git a/lib/kernel/EphemeralRelation.ml b/lib/kernel/EphemeralRelation.ml index fd40aff..250aacc 100644 --- a/lib/kernel/EphemeralRelation.ml +++ b/lib/kernel/EphemeralRelation.ml @@ -84,8 +84,7 @@ class ephemeral_relation ?program ?decide description value modes enumerate inpu Error (Error.undecidable_membership ()) else let* cursor = self#enumerate in - Protocols.Handle.releasing cursor (fun () -> - let* scan = Protocols.Cursor.require cursor in + Protocols.Cursor.consuming cursor (fun scan -> Protocols.Cursor.exists scan (fun member -> Concepts.Hash.hash_equals (Concepts.Tuple.hash member) (Concepts.Tuple.hash tuple) ) ) @@ -119,7 +118,6 @@ type binding = {root: Protocols.Handle.t; within: Protocols.Handle.t} (* The relation a program produced has to outlive the cursor over it. *) let enumerate_owned relation = - let open Utilities.Result in let owner = object method reference = true @@ -127,10 +125,7 @@ let enumerate_owned relation = method is_managed = true end in - match - let* enumerable = Protocols.Enumerable.require relation in - Protocols.Enumerable.enumerate enumerable - with + match Protocols.Enumerable.cursor relation with | Error c -> Protocols.Handle.release relation; Error c | Ok cursor -> Ok diff --git a/lib/kernel/Multigroup.ml b/lib/kernel/Multigroup.ml index 9fbd386..669babb 100644 --- a/lib/kernel/Multigroup.ml +++ b/lib/kernel/Multigroup.ml @@ -192,12 +192,8 @@ module Make (S : Abstract.Storage.STORAGE) = struct if not (Concepts.Mode.exhaustible modes BatSet.String.empty) then Error (Error.unjudgeable name) else - let* enumerable = Protocols.Enumerable.require relation in - let* cursor = Protocols.Enumerable.enumerate enumerable in - Protocols.Handle.releasing cursor (fun () -> - let* scan = Protocols.Cursor.require cursor in - let* first = Protocols.Cursor.next scan in - Ok (Option.to_list (Option.map (fun witness -> name, witness) first)) ) ) ) + let* first = Protocols.Enumerable.scan relation Protocols.Cursor.next in + Ok (Option.to_list (Option.map (fun witness -> name, witness) first)) ) ) class multigroup ?bind conn value schema_tree denial_tree = object (self) |
