Skip to content

Commit

Permalink
Applied suggestions from the code review
Browse files Browse the repository at this point in the history
  • Loading branch information
barambani committed May 3, 2018
1 parent 7dc91ad commit 5f3685d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/syntax/applicativeError.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
8 changes: 4 additions & 4 deletions tests/src/test/scala/cats/tests/ApplicativeErrorSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

0 comments on commit 5f3685d

Please sign in to comment.