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

Support for lifting IO actions without related Data/DataSource into Fetch #181

Closed
purrgrammer opened this issue Mar 1, 2019 · 0 comments

Comments

@purrgrammer
Copy link
Contributor

This is something that Omer Zach brought up in the Gitter channel, and we'd need to do some modifications to Fetch in order to support it. The idea is that, if you have an IO[A] or IO[Option[A]] that represents a Fetch but can't be batched, you should be able to lift it to Fetch. These IO actions wouldn't be batched or cached, so they execute every time a Fetch is run regardless of the contents of the cache.

def getUser: IO[User] = ???
def maybeGetUser: IO[Option[User]] = ???

def fetchUser[F[_] : ConcurrentEffect] : Fetch[F, User] = Fetch.liftIO(getUser)
def maybeFetchUser[F[_] : ConcurrentEffect] : Fetch[F, Option[User]] = Fetch.liftIO(maybeGetUser)

As a "side-effect", we'd be able to embed arbitrary IO actions in a Fetch, even those that perform writes/logging/debugging or anything else.

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

No branches or pull requests

1 participant