aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel/Merkle.ml
diff options
context:
space:
mode:
authorEstevan Castilho <tevo@riajuu.net>2026-10-24 01:30:08 +0000
committerEstevan Castilho <tevo@riajuu.net>2026-10-24 01:30:08 +0000
commit0f5161930584eaf91fd195b891ce7d9130c7b7f1 (patch)
treea505f4b7bfe8dc0b0efa06c42b75502aeb2f247a /lib/kernel/Merkle.ml
parent0b1c7ca41a6d8ce41b9783153b567c16250913ff (diff)
downloadRNT-0f5161930584eaf91fd195b891ce7d9130c7b7f1.tar.gz
RNT-0f5161930584eaf91fd195b891ce7d9130c7b7f1.zip
Forsake `fmap`
Diffstat (limited to '')
-rw-r--r--lib/kernel/Merkle.ml14
1 files changed, 7 insertions, 7 deletions
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