Closed
Description
Currently it's implemented as:
final class ServiceWithPartiallyApplied[Service](private val dummy: Boolean = true) extends AnyVal {
def apply[E, A](f: Service => ZIO[Has[Service], E, A])(implicit tag: Tag[Service]): ZIO[Has[Service], E, A] =
new ZIO.Read(r => f(r.get))
}
which requires that f
return a ZIO[Has[Service], ...]
. Why do we need that?
Let's say Service.doSomething
is a function with type ZIO[Has[AnotherService], ...]
, then this works:
ZIO.service[Service].flatMap(_.doSomething) :: ZIO[Has[Service] with Has[AnotherService], ...]
while this doesn't:
ZIO.serviceWith[Service](_.doSomething)
Metadata
Metadata
Assignees
Labels
No labels