-
Notifications
You must be signed in to change notification settings - Fork 8
Example code without infix operators #7
Copy link
Copy link
Open
Description
I'm struggling to understand the decoding example in the tests
let decode: Js.Json.t => Belt.Result.t(t, string) =
json => {
make
<$> JD.intFor("userId", json)
<*> JD.intFor("id", json)
<*> JD.stringFor("title", json)
<*> JD.boolFor("completed", json)
|> Relude.Result.fromValidation
|> Relude.Result.mapError(_ => "Decode failed");
};Would this be equal to the following?
let decode: Js.Json.t => Belt.Result.t(t, string) =
json => {
make
|> map(JD.intFor("userId", json))
|> ap(JD.intFor("id", json))
|> ap(JD.stringFor("title", json))
|> ap(JD.boolFor("completed", json))
|> Relude.Result.fromValidation
|> Relude.Result.mapError(_ => "Decode failed");
};With some direction, I'd be glad to open a PR adding examples sans infix operators. It would be nice to able to see the two versions side by side for mere mortals like I.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels