Trying to understand a way to do this without noisy explicit typing.
If I do the following:
// here maybeUser is Either[ServiceError, User]
// cacheService.remove(user) returns EitherT[Future, ServiceError, Unit]
def blah(): EitherT[Future, ServiceError, Unit] = {
for {
user <- EitherT.fromEither(maybeUser)
_ <- cacheService
.remove(user)
} yield ()
}
This will return the following error:
diverging implicit expansion for type cats.kernel.Order[A]
[error] starting with value catsKernelStdOrderForFiniteDuration in trait FiniteDurationInstances
[error] user <- EitherT.fromEither(maybeUser)
If I explicitly (noisy) type this, it works:
def blah(): EitherT[Future, ServiceError, Unit] = {
for {
user <- EitherT.fromEither(maybeUser):EitherT[Future, ServiceError, User]
_ <- cacheService
.remove(maybeUser)
} yield ()
}
But explicitly typing becomes tiresome after awhile, especially in other (larger) parts of the code. Any ideas?