From 5f3685d57ce9b9bd77d06f71435d35b35014487e Mon Sep 17 00:00:00 2001 From: Filippo Mariotti Date: Thu, 3 May 2018 16:25:03 +0100 Subject: [PATCH] Applied suggestions from the code review --- core/src/main/scala/cats/syntax/applicativeError.scala | 2 +- .../src/test/scala/cats/tests/ApplicativeErrorSuite.scala | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/main/scala/cats/syntax/applicativeError.scala b/core/src/main/scala/cats/syntax/applicativeError.scala index f889c317c5..95f3f6946a 100644 --- a/core/src/main/scala/cats/syntax/applicativeError.scala +++ b/core/src/main/scala/cats/syntax/applicativeError.scala @@ -71,6 +71,6 @@ final class ApplicativeErrorOps[F[_], E, A](val fa: F[A]) extends AnyVal { def onError(pf: PartialFunction[E, F[Unit]])(implicit F: ApplicativeError[F, E]): F[A] = F.onError(fa)(pf) - def or(other: F[A])(implicit F: ApplicativeError[F, E]): F[A] = + def orElse(other: => F[A])(implicit F: ApplicativeError[F, E]): F[A] = F.handleErrorWith(fa)(_ => other) } diff --git a/tests/src/test/scala/cats/tests/ApplicativeErrorSuite.scala b/tests/src/test/scala/cats/tests/ApplicativeErrorSuite.scala index 4a038343f1..2b34a42ae1 100644 --- a/tests/src/test/scala/cats/tests/ApplicativeErrorSuite.scala +++ b/tests/src/test/scala/cats/tests/ApplicativeErrorSuite.scala @@ -35,11 +35,11 @@ class ApplicativeErrorSuite extends CatsSuite { failed.recoverWith { case _ => Some(7) } should === (Some(7)) } - test("or leaves unchanged a success") { - 17.some or None should === (Some(17)) + test("orElse leaves a success unchanged") { + 17.some orElse None should === (Some(17)) } - test("or transforms an error to the alternative") { - failed or Some(17) should === (Some(17)) + test("orElse transforms an error to the alternative") { + failed orElse Some(17) should === (Some(17)) } }