Skip to content

Commit

Permalink
Merge pull request #725 from ceedubs/xort-orElse
Browse files Browse the repository at this point in the history
Remove AA >: A constraint from XorT.orElse
  • Loading branch information
fthomas committed Dec 9, 2015
2 parents 291568c + 8794f7f commit 32fa9e2
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions core/src/main/scala/cats/data/XorT.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,10 @@ final case class XorT[F[_], A, B](value: F[A Xor B]) {
}
}

def orElse[AA >: A, 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 _ => F.pure(xor)
}
def orElse[AA, BB >: B](default: => XorT[F, AA, BB])(implicit F: Monad[F]): XorT[F, AA, BB] = {
XorT(F.flatMap(value) {
case Xor.Left(_) => default.value
case r @ Xor.Right(_) => F.pure(r)
})
}

Expand Down

0 comments on commit 32fa9e2

Please sign in to comment.