EitherObjectOps

final class EitherObjectOps(either: Either) extends AnyVal
class AnyVal
trait Matchable
class Any

Value members

Concrete methods

def catchNonFatal[A](f: => A): Either[Throwable, A]
def catchOnly[T >: Null <: Throwable]: CatchOnlyPartiallyApplied[T]

Evaluates the specified block, catching exceptions of the specified type and returning them on the left side of the resulting Either. Uncaught exceptions are propagated.

Evaluates the specified block, catching exceptions of the specified type and returning them on the left side of the resulting Either. Uncaught exceptions are propagated.

For example:

scala> import cats.implicits._ // get syntax for Either
scala> Either.catchOnly[NumberFormatException] { "foo".toInt }
res0: Either[NumberFormatException, Int] = Left(java.lang.NumberFormatException: For input string: "foo")
def fromOption[A, B](o: Option[B], ifNone: => A): Either[A, B]

Converts an Option[B] to an Either[A, B], where the provided ifNone values is returned on the left of the Either when the specified Option is None.

Converts an Option[B] to an Either[A, B], where the provided ifNone values is returned on the left of the Either when the specified Option is None.

def fromTry[A](t: Try[A]): Either[Throwable, A]

Converts a Try[A] to a Either[Throwable, A].

Converts a Try[A] to a Either[Throwable, A].

def left[A, B](a: A): Either[A, B]
def leftNec[A, B](a: A): EitherNec[A, B]
def leftNel[A, B](a: A): EitherNel[A, B]
def leftNes[A, B](a: A)(O: Order[A]): EitherNes[A, B]
def right[A, B](b: B): Either[A, B]
def rightNec[A, B](b: B): EitherNec[A, B]
def rightNel[A, B](b: B): EitherNel[A, B]
def rightNes[A, B](b: B)(O: Order[B]): EitherNes[A, B]
def unit[A]: Either[A, Unit]

Cached value of Right(()) to avoid allocations for a common case.

Cached value of Right(()) to avoid allocations for a common case.