Skip to content
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

Remove calls to PartialFunction.apply, deprecated in 2.12.5 #2188

Merged
merged 1 commit into from Mar 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions laws/src/main/scala/cats/laws/ApplicativeErrorLaws.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ trait ApplicativeErrorLaws[F[_], E] extends ApplicativeLaws[F] {
F.attempt(F.pure(a)) <-> F.pure(Right(a))

def handleErrorWithConsistentWithRecoverWith[A](fa: F[A], f: E => F[A]): IsEq[F[A]] =
F.handleErrorWith(fa)(f) <-> F.recoverWith(fa)(PartialFunction(f))
F.handleErrorWith(fa)(f) <-> F.recoverWith(fa) { case x => f(x) }

def handleErrorConsistentWithRecover[A](fa: F[A], f: E => A): IsEq[F[A]] =
F.handleError(fa)(f) <-> F.recover(fa)(PartialFunction(f))
F.handleError(fa)(f) <-> F.recover(fa) { case x => f(x) }

def recoverConsistentWithRecoverWith[A](fa: F[A], pf: PartialFunction[E, A]): IsEq[F[A]] =
F.recover(fa)(pf) <-> F.recoverWith(fa)(pf andThen F.pure)
Expand All @@ -41,7 +41,7 @@ trait ApplicativeErrorLaws[F[_], E] extends ApplicativeLaws[F] {
F.attempt(F.fromEither(eab)) <-> F.pure(eab)

def onErrorPure[A](a: A, f: E => F[Unit]): IsEq[F[A]] =
F.onError(F.pure(a))(PartialFunction(f)) <-> F.pure(a)
F.onError(F.pure(a)) { case x => f(x) } <-> F.pure(a)

def onErrorRaise[A](fa: F[A], e: E, fb: F[Unit]): IsEq[F[A]] =
F.onError(F.raiseError[A](e)){case err => fb} <-> F.map2(fb, F.raiseError[A](e))((_, b) => b)
Expand Down
4 changes: 2 additions & 2 deletions laws/src/main/scala/cats/laws/MonadErrorLaws.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ trait MonadErrorLaws[F[_], E] extends ApplicativeErrorLaws[F, E] with MonadLaws[
F.ensureOr(fa)(e)(p) <-> F.flatMap(fa)(a => if (p(a)) F.pure(a) else F.raiseError(e(a)))

def adaptErrorPure[A](a: A, f: E => E): IsEq[F[A]] =
F.adaptError(F.pure(a))(PartialFunction(f)) <-> F.pure(a)
F.adaptError(F.pure(a)) { case x => f(x) } <-> F.pure(a)

def adaptErrorRaise[A](e: E, f: E => E): IsEq[F[A]] =
F.adaptError(F.raiseError[A](e))(PartialFunction(f)) <-> F.raiseError(f(e))
F.adaptError(F.raiseError[A](e)) { case x => f(x) } <-> F.raiseError(f(e))

def rethrowAttempt[A](fa: F[A]): IsEq[F[A]] =
F.rethrow(F.attempt(fa)) <-> fa
Expand Down