-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Generalize Type Signature of ServiceWith #5558
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
Conversation
@@ -5427,7 +5427,7 @@ object ZIO extends ZIOCompanionPlatformSpecific { | |||
} | |||
|
|||
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] = | |||
def apply[R <: Has[Service], E, A](f: Service => ZIO[R, E, A])(implicit tag: Tag[Service]): ZIO[R with Has[Service], E, A] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this work:
def apply[R <: Has[Service], E, A](f: Service => ZIO[R, E, A])(implicit tag: Tag[Service]): ZIO[R with Has[Service], E, A] = | |
def apply[R, E, A](f: Service => ZIO[R, E, A])(implicit tag: Tag[Service]): ZIO[R, E, A] = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was my original formulation. 😃
The issue there is that it leads to a lot of spurious warnings about R
being inferred as Any
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or to be more precise there are a couple of permutations:
def apply[R, E, A](f: Service => ZIO[R, E, A])(implicit
tag: Tag[Service]
): ZIO[R with Has[Service], E, A] =
This one leads to spurious warnings about a type being inferred as Any
.
def apply[R <: Has[Service], E, A](f: Service => ZIO[R, E, A])(implicit
tag: Tag[Service]
): ZIO[R, E, A]
This one leads to numerous warnings of missing parameter type for the effectual function.
Fixes #5555.