RR Fetch Syntax - #33
Merged
7 commits merged intoMay 21, 2016
Merged
Conversation
| ### error | ||
|
|
||
| Errors can also be lifted to the Fetch monad via `exception.fetch`. Note that interpreting | ||
| an errorful fetch to `Eval` will throw the exception so we won't do that: |
There was a problem hiding this comment.
In the case of Eval it won't throw the exception unless accessing the value with .value, maybe we can show how the exception is conveyed on the Xor.Left when ussing the attempt combinator?
|
Other than the comment LGTM, really awesome work 👍 |
Contributor
Author
|
Feel free to reword or remove that part for now if you want this to be included in the release.I won't be close to a computer this evening |
|
All right, i'll edit that part and cut another release with the new syntax and docs. |
|
|
ghost
deleted the
rr-fetch-syntax
branch
May 21, 2016 12:00
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The following PR provides implicit syntax to lift any
AtoFetch[A]as well as syntax for the most useful combinators on aFetch[A].@dialelo @rafaparadela Can you please review? Thanks!
Pseudo extract from the included docs contribution:
Syntax
Implicit syntax
Fetch provides implicit syntax to lift any value to the context of a
Fetchin addition to the most common used combinators active withinFetchinstances.pure
Plain values can be lifted to the Fetch monad with
value.fetch:Executing a pure fetch doesn't query any data source, as expected.
error
Errors can also be lifted to the Fetch monad via
exception.fetch. Note that interpretingan errorful fetch to
Evalwill throw the exception so we won't do that:join
We can compose two independent fetches with
fetch1.join(fetch2).If the fetches are to the same data source they will be batched; if they aren't, they will be evaluated at the same time.
runA
Run directly any fetch to a target any target
Monadwith aMonadErrorinstance in scopefetch1.runA[Eval].runE
Extract a fetch an get it's runtime environment
fetch1.runE[Eval].runF
Run a fetch obtaining the environment and final value
fetch1.runF[Eval].