Implicit wrapper to convert arbitrary Either objects to scala.util.Try, right-biasing
Implicit wrapper to convert arbitrary Either objects to scala.util.Try, right-biasing
the Left type of the wrapped object
the Right type of the wrapped object
Implicit wrapper to convert regular objects to scala.util.Either
Implicit wrapper to convert regular objects to scala.util.Either
import com.paypal.cascade.common.either._ "hello".toRight[Throwable] // Either[Throwable, String] "hello".toLeft[Int] // Either[String, Int] (new Throwable("error")).toLeft[String] // Either[Throwable, String]
the type of the wrapped object
Implicit wrapper to convert Either[Throwable, A] objects to scala.util.Try, right-biasing
Implicit wrapper to convert Either[Throwable, A] objects to scala.util.Try, right-biasing
the Right type of the wrapped object
Convenience methods and implicits for working with scala.util.Either.
When working with Either, our convention is to right-bias correct values. That is, when working with an Either, prefer to use
Either[Failure, Success]
as the pattern.Additionally, strongly prefer to use scala.util.Try over Either whenever a failure case is to be a Throwable. In general practice, this should encompass the vast majority of cases.