map both
apply the given function if it's a Right
apply the given function if it's a Left
apply the given function if it's a Left
(read as flatMap other)
scala> import sclib.ops.either._ scala> 5.left.flatMapO(_.right) res0: scala.util.Either[Nothing,Int] = Right(5)
get the current value if it's a Right
otherwise return the given argument
apply the given function if it's a Right
apply the given function if it's a Left
apply the given function if it's a Left
(read as map other)
scala> import sclib.ops.either._ scala> 5.right[Int].mapO(_ + 1) res0: scala.util.Either[Int,Int] = Right(5) scala> 5.left.mapO(_ + 1) res1: scala.util.Either[Int,Nothing] = Left(6)
get the current value as a Some
if it's a Right
otherwise return None
get the current value as a Success
if it's a Right
otherwise return Failure
with the Left site
extensions on
Either
instances