diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-13 03:19:46 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-09-13 03:19:46 -0300 |
| commit | 9b9eab0bb54ed951c56eb6551d9ee470dc5b43aa (patch) | |
| tree | eb5bef6ac815aa4fdc95c52838626ab1826c4fb0 /lib/kernel/Tuple.ml | |
| parent | 327d0d2a47591e02299d4e7360d5b7e03b4962d2 (diff) | |
| download | RNT-9b9eab0bb54ed951c56eb6551d9ee470dc5b43aa.tar.gz RNT-9b9eab0bb54ed951c56eb6551d9ee470dc5b43aa.zip | |
appropriate enumeration for tuple split on object and resident
Diffstat (limited to '')
| -rw-r--r-- | lib/kernel/Tuple.ml | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/kernel/Tuple.ml b/lib/kernel/Tuple.ml index 50ce5b5..ef591ae 100644 --- a/lib/kernel/Tuple.ml +++ b/lib/kernel/Tuple.ml @@ -19,6 +19,8 @@ module Make (S : Abstract.Storage.STORAGE) = struct module Attribute = struct type t = Concepts.Value.value + let malformed_value = Error.malformed_value + let encode value = let open Concepts.Encoding in Bencode.to_blob @@ -33,7 +35,7 @@ module Make (S : Abstract.Storage.STORAGE) = struct match data with | Bencode.Tagged ('s', Bencode.String s) -> Ok (Concepts.Value.String s) | Bencode.Tagged ('i', Bencode.Int n) -> Ok (Concepts.Value.Integer n) - | _ -> Error (Error.malformed_value ()) + | _ -> Error (malformed_value ()) let domain = function | Concepts.Value.String _ -> "string" @@ -90,11 +92,12 @@ module Make (S : Abstract.Storage.STORAGE) = struct let open Utilities.Result in let* node = AttributeM.with_batch tx (fun () -> - BatMap.String.foldi - (fun name value node -> - let* node = node in - AttributeM.insert tx name value node) - attributes (Ok AttributeM.empty)) + BatMap.String.enum attributes + |> BatEnum.fold + (fun node (name, value) -> + let* node = node in + AttributeM.insert tx name value node) + (Ok AttributeM.empty)) in Ok { type_; attributes = AttributeM.hash_of node } |
