Skip to content

Commit

Permalink
Tweak the case in patmat
Browse files Browse the repository at this point in the history
  • Loading branch information
danicheg committed Jul 21, 2024
1 parent 5d74ad5 commit 1ccfee3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions core/src/main/scala/cats/syntax/either.scala
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ final class EitherOps[A, B](private val eab: Either[A, B]) extends AnyVal {

def leftMapOrKeep[AA >: A](pf: PartialFunction[A, AA]): Either[AA, B] =
eab match {
case Left(a) => Left(pf.applyOrElse(a, identity[AA]))
case r @ Right(_) => r
case Left(a) => Left(pf.applyOrElse(a, identity[AA]))
case r: Right[A, B] => r
}

@deprecated("Included in the standard library", "2.1.0-RC1")
Expand All @@ -215,8 +215,8 @@ final class EitherOps[A, B](private val eab: Either[A, B]) extends AnyVal {

def leftFlatMapOrKeep[AA >: A, BB >: B](pfa: PartialFunction[A, Either[AA, BB]]): Either[AA, BB] =
eab match {
case l @ Left(a) => pfa.applyOrElse(a, (_: A) => l)
case r @ Right(_) => r
case l @ Left(a) => pfa.applyOrElse(a, (_: A) => l)
case r: Right[A, B] => r
}

def compare[AA >: A, BB >: B](that: Either[AA, BB])(implicit AA: Order[AA], BB: Order[BB]): Int =
Expand Down

0 comments on commit 1ccfee3

Please sign in to comment.