-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Can't use MonadError syntax for EitherT #2022
Comments
Actually I still have this issue with val e: EitherT[ConnectionIO, A, B] = ???
e.handleErrorWith(1) // required: Throwable => EitherT[ConnectionIO,A,B]
// [error] found : A => cats.data.EitherT[doobie.ConnectionIO,A,B]
// [error] required: Throwable => cats.data.EitherT[doobie.ConnectionIO,A,B]
//[error] e.handleErrorWith((a: A) => EitherT.left(a.pure[ConnectionIO]))
e.handleErrorWith((a: A) => EitherT.left(a.pure[ConnectionIO])) |
@wedens not sure I fully understand your second example, were those error caused by |
it's just type class syntax extension cannot differentiate the two instance available: implicit val me = MonadError[EitherT[ConnectionIO, A, ?], A]
e.handleError((a:A) => someB) I see 3 options to fix it in Cats.
def handleError[E](f: T => E)(implicit ME: MonadError[EitherT[F, L, ?], E]) = ME.handleError(this)(f) This is likely to get rid off the ambiguity, but I haven't test it. |
With introduction (#1644) of prioritised
MonadError
instance forF: MonadError
inEitherT[F, E, A]
, it's now impossible to useMonadError
syntax for handlingE
.It makes it difficult to upgrade to 1.0.0-RC1 as this syntax is used quite a bit in a project.
The text was updated successfully, but these errors were encountered: