Skip to content
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

Introduce Fetch#optional for performing optional fetches #159

Merged
merged 4 commits into from
Sep 20, 2018

Conversation

purrgrammer
Copy link
Contributor

@purrgrammer purrgrammer commented Sep 19, 2018

You can create Fetch values with Fetch#optional instead of Fetch#apply and you'll get back a Fetch[F, Option[A]] instead of a Fetch[F, A].

I still want to experiment working with optional fetches using OptionT but this change solves #45

  • Update docs
  • Add more testing

@codecov
Copy link

codecov bot commented Sep 19, 2018

Codecov Report

Merging #159 into master will increase coverage by 0.61%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #159      +/-   ##
==========================================
+ Coverage    90.5%   91.12%   +0.61%     
==========================================
  Files           5        5              
  Lines         158      169      +11     
  Branches        5        5              
==========================================
+ Hits          143      154      +11     
  Misses         15       15
Impacted Files Coverage Δ
shared/src/main/scala/fetch.scala 92% <100%> (+0.63%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47cc4e9...8edd14a. Read the comment docs.

case FetchDone(a) =>
Done(Some(a)).asInstanceOf[FetchResult[F, Option[A]]]
case FetchMissing() =>
Done(None).asInstanceOf[FetchResult[F, Option[A]]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need the cast here. Can we try Option.empty[A]?

@purrgrammer purrgrammer merged commit 27ea529 into master Sep 20, 2018
@purrgrammer purrgrammer deleted the optional-fetches branch September 20, 2018 12:25
@JorgeCastilloPrz
Copy link

Added to the ongoing redesign of Kollect.

bijancn pushed a commit to bijancn/fetch that referenced this pull request Sep 19, 2019
Introduce Fetch#optional for performing optional fetches
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants