From 0f5161930584eaf91fd195b891ce7d9130c7b7f1 Mon Sep 17 00:00:00 2001 From: Estevan Castilho Date: Sat, 24 Oct 2026 01:30:08 +0000 Subject: Forsake `fmap` --- lib/kernel/Branch.ml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'lib/kernel/Branch.ml') diff --git a/lib/kernel/Branch.ml b/lib/kernel/Branch.ml index 561bff3..439339e 100644 --- a/lib/kernel/Branch.ml +++ b/lib/kernel/Branch.ml @@ -50,14 +50,13 @@ module Make (S : Abstract.Storage.STORAGE) = struct let of_fields fields = let open Utilities.Result in let open Concepts.Encoding in - let* multigroups = Bencode.field "multigroups" fields |> fmap Value.hash_of_bencode in + let* multigroups = Bencode.field "multigroups" fields |>> Value.hash_of_bencode in let* previous = Bencode.field "previous" fields - |> fmap - (Value.option_of_bencode (fun v -> - Value.hash_of_bencode v - |> Result.map (fun hash -> S.Hash hash) - |> Result.map (SI.Pointer.make Loader.load) ) ) + |>> Value.option_of_bencode (fun v -> + Value.hash_of_bencode v + |> Result.map (fun hash -> S.Hash hash) + |> Result.map (SI.Pointer.make Loader.load) ) in Ok {multigroups; previous} end @@ -65,7 +64,7 @@ module Make (S : Abstract.Storage.STORAGE) = struct and Loader : sig val load : S.transaction -> S.address -> (t, Concepts.Condition.condition) result end = struct - let load tx addr = SI.get_req tx addr |> Utilities.Result.fmap Representation.of_blob + let load tx addr = Utilities.Result.(SI.get_req tx addr |>> Representation.of_blob) end let pointer_of hash = SI.Pointer.make Loader.load (S.Hash hash) @@ -73,7 +72,7 @@ module Make (S : Abstract.Storage.STORAGE) = struct let node_of tx branch = let open Utilities.Result in MultigroupM.find tx branch.multigroups - |> fmap (Option.to_result ~none:(Error.incomplete_branch branch.multigroups)) + |>> Option.to_result ~none:(Error.incomplete_branch branch.multigroups) (* Given [root], the stored programs of this state run through the evaluators registered under it, against this very state, so an @@ -144,7 +143,7 @@ module Make (S : Abstract.Storage.STORAGE) = struct update_only (fun node' -> Handle.require Addressable.from node' |> Result.map Addressable.address - |> fmap (fun addr -> self#deriving {branch with multigroups= addr}) ) ) ] ); + |>> (fun addr -> self#deriving {branch with multigroups= addr}) ) ) ] ); Directory.make object method list = -- cgit v1.2.3