Remove usage of Lwt_result.map.

Commit
6c905b7f14f56ec41626dc5171c9cbcdcfae6f1b
Author
Marius Peter <marius.peter@tutanota.com>
Author date
Committer
Marius Peter <marius.peter@tutanota.com>
Committer date
lib/resolvers.ml
index 0beb6755..488ec569 100644..100644
@@ -2,8 +2,6 @@
2 2
3 3 module Store = Git_unix.Store
4 4 open Lwt_result.Syntax
5 Removed:
6 Removed: (* open Lwt_result.Infix *)
7 5 open Config
8 6
9 7 let full_path path = Filename.concat config.git_project_root path
@@ -40,10 +38,9 @@
40 38 let of_id repo id =
41 39 let* store = store repo in
42 40 let hash = Store.Hash.of_hex id in
43 Removed: Store.read store hash
44 Removed: |> Lwt_result.map @@ function
45 Removed: | Git.Value.Commit commit -> to_t commit
46 Removed: | _ -> failwith (id ^ " does not point to a commit object")
41 Added: Lwt_result.bind (Store.read store hash) @@ function
42 Added: | Git.Value.Commit commit -> Lwt_result.return (to_t commit)
43 Added: | _ -> Lwt_result.fail @@ `Msg (id ^ " does not point to a commit object")
47 44
48 45 let head repo =
49 46 let* store = store repo in
@@ -76,9 +73,10 @@
76 73 let branches =
77 74 List.map
78 75 (fun (reference, hash) ->
79 Removed: let name = Git.Reference.to_string reference in
80 Removed: let hash = Store.Hash.to_hex hash in
81 Removed: { name; hash })
76 Added: {
77 Added: name = Git.Reference.to_string reference;
78 Added: hash = Store.Hash.to_hex hash;
79 Added: })
82 80 refs
83 81 in
84 82 Lwt_result.return branches
@@ -123,8 +121,8 @@
123 121 let* store = store repo in
124 122 let hash = Store.Hash.of_hex id in
125 123 Lwt_result.bind (Store.read store hash) @@ function
126 Removed: | Git.Value.Tree tree -> to_t tree |> Lwt_result.return
127 Removed: | _ -> `Msg "no head tree id" |> Lwt_result.fail
124 Added: | Git.Value.Tree tree -> Lwt_result.return (to_t tree)
125 Added: | _ -> Lwt_result.fail @@ `Msg ("no tree for id " ^ id)
128 126
129 127 let head repo : (t, Store.error) Lwt_result.t =
130 128 let* store = store repo in
@@ -144,8 +142,7 @@
144 142 let of_id repo id =
145 143 let* store = store repo in
146 144 let hash = Store.Hash.of_hex id in
147 Removed: Store.read store hash
148 Removed: |> Lwt_result.map @@ function
149 Removed: | Git.Value.Blob blob -> to_t blob
150 Removed: | _ -> failwith (id ^ " does not point to a blob object")
145 Added: Lwt_result.bind (Store.read store hash) @@ function
146 Added: | Git.Value.Blob blob -> Lwt_result.return (to_t blob)
147 Added: | _ -> Lwt_result.fail @@ `Msg (id ^ " does not point to a blob object")
151 148 end