Basically I am trying to make generators which are the result of HTTP requests, due to this I often end up with types like Gen[EitherT[Future, Error, T]]
.
The problem is that there doesn't appear to be any monadic instances (so I can do sequence
, or monad transformers) that let me compose different instances of Gen[EitherT[Future, Error, T]]
As an example, suppose we have the following functions
def genUser: Gen[EitherT[Future, Error, User]]
and
def genAccounts(user: User): Gen[EitherT[Future, Error, List[Account]]
The idea is to be able to properly compose the Gen[EitherT[Future, Error,T]
types, so that genAccounts
calls genUser
, i.e. something like
def genAccounts(user: User): Gen[EitherT[Future, Error, List[Account]] = for {
user <- genUser
accounts <- genAccounts(user)
} yield accounts
Also does scalacheck Gen
provide a way to lift a Future
into a Gen
(i.e. a way to go from Gen[Future[T]]
to just a Gen[T]
). Even if this is blocking, its not a huge issue if it only happens once when we generate the final Gen
property