Skip to content

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

Description

@purrgrammer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions