Skip to content

Commit

Permalink
Minor cleanup to XorT.orElse implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceedubs committed Dec 9, 2015
1 parent 0118b84 commit 8794f7f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions core/src/main/scala/cats/data/XorT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ final case class XorT[F[_], A, B](value: F[A Xor B]) {
}

def orElse[AA, BB >: B](default: => XorT[F, AA, BB])(implicit F: Monad[F]): XorT[F, AA, BB] = {
XorT(F.flatMap(value) { xor =>
xor match {
case Xor.Left(_) => default.value
case r @ Xor.Right(_) => F.pure(r)
}
XorT(F.flatMap(value) {
case Xor.Left(_) => default.value
case r @ Xor.Right(_) => F.pure(r)
})
}

Expand Down

0 comments on commit 8794f7f

Please sign in to comment.