aboutsummaryrefslogtreecommitdiffstats
path: root/lib/protocols/Enumerable.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-10-12 11:58:25 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-10-12 11:58:25 -0300
commitad33454a204aa5791445e7d15f02ba0447fff85e (patch)
treeb1730a9ac5b40ff58ddc23976cd5df5dac924231 /lib/protocols/Enumerable.ml
parentd4f603fa04283efe54c79b5f7664c4c9bc193857 (diff)
downloadRNT-ad33454a204aa5791445e7d15f02ba0447fff85e.tar.gz
RNT-ad33454a204aa5791445e7d15f02ba0447fff85e.zip
relation scan with enumerable and release
Diffstat (limited to 'lib/protocols/Enumerable.ml')
-rw-r--r--lib/protocols/Enumerable.ml2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/protocols/Enumerable.ml b/lib/protocols/Enumerable.ml
index 53db834..76b4e86 100644
--- a/lib/protocols/Enumerable.ml
+++ b/lib/protocols/Enumerable.ml
@@ -19,3 +19,5 @@ let make impl = Enumerable (impl :> implementation)
let from handle = Handle.into handle (function Enumerable impl -> Some impl | _ -> None)
let require handle = from handle |> Option.to_result ~none:(Error.not_enumerable ())
let enumerate i = Handle.invoke i (fun o -> o#enumerate)
+let cursor handle = Result.bind (require handle) enumerate
+let scan handle f = Result.bind (cursor handle) (fun cursor -> Cursor.consuming cursor f)