-
-
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
Move adaptError #3148
Move adaptError #3148
Conversation
Codecov Report
@@ Coverage Diff @@
## master #3148 +/- ##
=========================================
Coverage ? 93.28%
=========================================
Files ? 376
Lines ? 7323
Branches ? 200
=========================================
Hits ? 6831
Misses ? 492
Partials ? 0
Continue to review full report at Codecov.
|
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.
There are conflicts now, but looks good in principle.
@@ -124,8 +124,7 @@ final class ApplicativeErrorOps[F[_], E, A](private val fa: F[A]) extends AnyVal | |||
* }}} | |||
* | |||
* This is the same as `MonadErrorOps#adaptError`. It cannot have the same name because | |||
* this would result in ambiguous implicits. `adaptError` will be moved from `MonadError` | |||
* to `ApplicativeError` in Cats 2.0: see [[https://github.com/typelevel/cats/issues/2685]] | |||
* this would result in ambiguous implicits. | |||
*/ | |||
def adaptErr(pf: PartialFunction[E, E])(implicit F: ApplicativeError[F, E]): F[A] = | |||
F.recoverWith(fa)(pf.andThen(F.raiseError[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.
Nit: is there any reason to keep a duplicate implementation, now that it's on the constraint?
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.
Agreed, thanks for catching this!
Okay, conflict is resolved and implementation is de-duplicated. I've also added some syntax tests. |
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.
👍
Fixes #2685.
Unfortunately I don't think we can fix the syntax without breaking bincompat due to a compiler bug: #2685 (comment)