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/Merkle.ml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'lib/kernel/Merkle.ml') diff --git a/lib/kernel/Merkle.ml b/lib/kernel/Merkle.ml index 6b44c41..c64a9a3 100644 --- a/lib/kernel/Merkle.ml +++ b/lib/kernel/Merkle.ml @@ -87,14 +87,14 @@ functor as_string t |> Result.map String.to_bytes |> Result.map Concepts.Blob.blob_of_bytes - |> fmap K.decode + |>> K.decode in let decode_value t = as_string t |> Result.map Concepts.Hash.of_raw_string in let decode_list f data = data - |> fmap as_list + |>> as_list |> Result.map (List.map f) - |> fmap Utilities.List.sequence + |>> Utilities.List.sequence |> Result.map BatFingerTree.of_list in function @@ -108,7 +108,7 @@ functor Ok (Trunk {keys; children}) | _ -> Error (Error.malformed_node ()) - let from_blob blob = Concepts.Encoding.Bencode.of_blob blob |> Utilities.Result.fmap of_bencode + let from_blob blob = Utilities.Result.(Concepts.Encoding.Bencode.of_blob blob |>> of_bencode) let to_bencode = let open Concepts.Encoding.Bencode in @@ -381,7 +381,7 @@ functor let rec shrink tx = function | Trunk {children; _} when BatFingerTree.size children = 1 -> - Utilities.Result.fmap (shrink tx) (find' tx (BatFingerTree.get children 0)) + Result.bind (find' tx (BatFingerTree.get children 0)) (shrink tx) | node -> Ok node let remove tx key node = @@ -454,7 +454,7 @@ functor let* () = S.put tx (S.Hash addr) data in Ok addr - let retrieve tx addr = SI.get_req tx (S.Hash addr) |> fmap V.decode + let retrieve tx addr = SI.get_req tx (S.Hash addr) |>> V.decode let find = Tree.find let from x = x let into x = x @@ -470,7 +470,7 @@ functor let of_list tx bindings = List.map (fun (k, v) -> intern tx v |> Result.map (fun addr -> k, addr)) bindings |> Utilities.List.sequence - |> fmap (Tree.of_list tx) + |>> Tree.of_list tx let remove = Tree.remove -- cgit v1.2.3