aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/Merkle.ml
diff options
context:
space:
mode:
authorMarcos Magueta <maguetamarcos@gmail.com>2026-10-12 11:52:01 -0300
committerMarcos Magueta <maguetamarcos@gmail.com>2026-10-12 11:52:01 -0300
commit8cddc12efdff4fe1742039df493ab5e425a685c4 (patch)
treeed06a2c30307a7f6c16d37622c343b29dc5928e0 /lib/kernel/Merkle.ml
parenta3acc318ead5620ac20f70815b4dfb0810ccd2a4 (diff)
downloadRNT-8cddc12efdff4fe1742039df493ab5e425a685c4.tar.gz
RNT-8cddc12efdff4fe1742039df493ab5e425a685c4.zip
result fold left
Diffstat (limited to 'lib/kernel/Merkle.ml')
-rw-r--r--lib/kernel/Merkle.ml17
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/kernel/Merkle.ml b/lib/kernel/Merkle.ml
index 266a560..78ab5a5 100644
--- a/lib/kernel/Merkle.ml
+++ b/lib/kernel/Merkle.ml
@@ -29,9 +29,7 @@ module type TREE = functor (S : Abstract.Storage.STORAGE) (K : KEY) -> sig
val insert :
S.transaction -> K.t -> address -> node -> (node, Concepts.Condition.condition) result
- val of_list :
- S.transaction -> (K.t * address) list -> (node, Concepts.Condition.condition) result
-
+ val of_list : S.transaction -> (K.t * address) list -> (node, Concepts.Condition.condition) result
val remove : S.transaction -> K.t -> node -> (node, Concepts.Condition.condition) result
val lookup : S.transaction -> K.t -> node -> (address option, Concepts.Condition.condition) result
@@ -330,11 +328,9 @@ functor
let open Utilities.Result in
with_batch tx (fun () ->
let* _ = empty_under tx in
- List.fold_left
- (fun node (key, value) ->
- let* node = node in
- insert tx key value node )
- (Ok empty) bindings )
+ Utilities.List.fold_left
+ (fun node (key, value) -> insert tx key value node)
+ empty bindings )
let rec fold_left tx f acc =
let open Utilities.Result in
@@ -344,12 +340,11 @@ functor
|> BatFingerTree.fold_left (fun acc (k, v) -> f acc k v) acc
|> Result.ok
| Trunk {children; _} ->
- BatFingerTree.fold_left
+ Utilities.FingerTree.fold_left
(fun acc addr ->
- let* acc = acc in
let* node = find' tx addr in
fold_left tx f acc node )
- (Ok acc) children
+ acc children
let keys tx node =
fold_left tx (fun acc k _ -> BatFingerTree.snoc acc k) BatFingerTree.empty node