-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Example code without infix operators #7
Comments
This is a bit of a weird one, because the "prefix" version of ap(
ap(
map(make, JD.intFor("userId", json)),
JD.intFor("id", json)
),
JD.stringFor("title", json)
) However! The special Alternatively, bs-decode's pipeline (inspired by Elm and built around a flipped version of ap), can be used to avoid the infix functions. Or for a small example like this, maybe it makes sense to just use |
Interesting. For some reason I was under the impression that |
Just to add to what @mlms13 said, and to provide more background: The https://github.com/mlms13/bs-decode/blob/master/src/DecodeBase.re#L210
so You could use flipped versions of Anyway, the point of these tests isn't really to demonstrate how applicative-style decoding works, so maybe it would be best to just take this out of the tests, and just focus on the fetch calls. For usage of bs-decode, it would be better to refer to the docs in bs-decode. That said, I think it's worth the time to learn how |
Thanks for the clarification guys :) |
I'm struggling to understand the decoding example in the tests
Would this be equal to the following?
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.
The text was updated successfully, but these errors were encountered: