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

Lift Concurrent actions to Fetch #189

Merged
merged 2 commits into from
Apr 26, 2019
Merged

Lift Concurrent actions to Fetch #189

merged 2 commits into from
Apr 26, 2019

Conversation

purrgrammer
Copy link
Contributor

Closes #188

@purrgrammer purrgrammer requested a review from diesalbla April 25, 2019 15:09
@@ -316,6 +319,16 @@ object `package` {
}
} yield result)

def liftF[F[_] : Concurrent, A](f: F[A]): Fetch[F, A] =
Unfetch[F, A](for {
either <- f.attempt
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer avoiding single-line for comprehensions:

Unfetch[F, A] ( f.attempt.map {
  case Left(err) => Throw[F, A](log => UnhandledException(err, log))
  case Right(r)  => Done[F, A](r)
})

@purrgrammer purrgrammer merged commit f47a1e1 into master Apr 26, 2019
@purrgrammer purrgrammer deleted the liftf branch April 26, 2019 09:46
bijancn pushed a commit to bijancn/fetch that referenced this pull request Sep 19, 2019
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.

Support for lifting F[_]: Concurrent without related Data/DataSource into Fetch
2 participants