Packages

c

cats.syntax

EitherOps

final class EitherOps[A, B] extends AnyVal

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. EitherOps
  2. AnyVal
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new EitherOps(eab: Either[A, B])

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    Any
  2. final def ##(): Int
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    Any
  4. def ===[AA >: A, BB >: B](that: Either[AA, BB])(implicit AA: Eq[AA], BB: Eq[BB]): Boolean
  5. def ap[AA >: A, BB >: B, C](that: Either[AA, (BB) ⇒ C]): Either[AA, C]
  6. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  7. def bimap[C, D](fa: (A) ⇒ C, fb: (B) ⇒ D): Either[C, D]
  8. final def combine[AA >: A, BB >: B](that: Either[AA, BB])(implicit BB: Semigroup[BB]): Either[AA, BB]

    Combine with another Either value.

    Combine with another Either value.

    If this Either is a Left then it will be returned as-is. If this Either is a Right and that Either is a left, then that will be returned. If both Eithers are Rights, then the Semigroup[BB] instance will be used to combine both values and return them as a Right. Note: If both Eithers are Lefts then their values are not combined. Use Validated if you prefer to combine Left values.

    Examples:

    scala> import cats.implicits._
    scala> val l1: Either[String, Int] = Either.left("error 1")
    scala> val l2: Either[String, Int] = Either.left("error 2")
    scala> val r3: Either[String, Int] = Either.right(3)
    scala> val r4: Either[String, Int] = Either.right(4)
    
    scala> l1 combine l2
    res0: Either[String, Int] = Left(error 1)
    
    scala> l1 combine r3
    res1: Either[String, Int] = Left(error 1)
    
    scala> r3 combine l1
    res2: Either[String, Int] = Left(error 1)
    
    scala> r3 combine r4
    res3: Either[String, Int] = Right(7)
  9. def compare[AA >: A, BB >: B](that: Either[AA, BB])(implicit AA: Order[AA], BB: Order[BB]): Int
  10. def ensure[AA >: A](onFailure: ⇒ AA)(f: (B) ⇒ Boolean): Either[AA, B]
  11. def ensureOr[AA >: A](onFailure: (B) ⇒ AA)(f: (B) ⇒ Boolean): Either[AA, B]
  12. def exists(f: (B) ⇒ Boolean): Boolean
  13. def flatMap[AA >: A, D](f: (B) ⇒ Either[AA, D]): Either[AA, D]
  14. def foldLeft[C](c: C)(f: (C, B) ⇒ C): C
  15. def foldRight[C](lc: Eval[C])(f: (B, Eval[C]) ⇒ Eval[C]): Eval[C]
  16. def forall(f: (B) ⇒ Boolean): Boolean
  17. def foreach(f: (B) ⇒ Unit): Unit
  18. def getClass(): Class[_ <: AnyVal]
    Definition Classes
    AnyVal → Any
  19. def getOrElse[BB >: B](default: ⇒ BB): BB
  20. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  21. def leftFlatMap[C, BB >: B](f: (A) ⇒ Either[C, BB]): Either[C, BB]
  22. def leftMap[C](f: (A) ⇒ C): Either[C, B]
  23. def liftTo[F[_]](implicit F: ApplicativeError[F, _ >: A]): F[B]

    lift the Either into a F[_] with ApplicativeError[F, A] instance

    lift the Either into a F[_] with ApplicativeError[F, A] instance

    scala> import cats.implicits._
    scala> import cats.data.EitherT
    scala> val e: Either[String, Int] = Right(3)
    scala> e.liftTo[EitherT[Option, CharSequence, ?]]
    res0: cats.data.EitherT[Option, CharSequence, Int] = EitherT(Some(Right(3)))
  24. def map[C](f: (B) ⇒ C): Either[A, C]
  25. def map2Eval[AA >: A, C, Z](fc: Eval[Either[AA, C]])(f: (B, C) ⇒ Z): Eval[Either[AA, Z]]
  26. def orElse[C, BB >: B](fallback: ⇒ Either[C, BB]): Either[C, BB]
  27. def partialCompare[AA >: A, BB >: B](that: Either[AA, BB])(implicit AA: PartialOrder[AA], BB: PartialOrder[BB]): Double
  28. def raiseOrPure[F[_]](implicit ev: ApplicativeError[F, A]): F[B]
  29. def recover[BB >: B](pf: PartialFunction[A, BB]): Either[A, BB]
  30. def recoverWith[AA >: A, BB >: B](pf: PartialFunction[A, Either[AA, BB]]): Either[AA, BB]
  31. def show[AA >: A, BB >: B](implicit AA: Show[AA], BB: Show[BB]): String
  32. def to[F[_]](implicit F: Alternative[F]): F[B]
  33. def toEitherNec[AA >: A]: EitherNec[AA, B]
  34. def toEitherNel[AA >: A]: EitherNel[AA, B]
  35. def toEitherNes[AA >: A](implicit O: Order[AA]): EitherNes[AA, B]
  36. def toEitherT[F[_]](implicit arg0: Applicative[F]): EitherT[F, A, B]

    Transform the Either into a cats.data.EitherT while lifting it into the specified Applicative.

    Transform the Either into a cats.data.EitherT while lifting it into the specified Applicative.

    scala> import cats.implicits._
    scala> val e: Either[String, Int] = Right(3)
    scala> e.toEitherT[Option]
    res0: cats.data.EitherT[Option, String, Int] = EitherT(Some(Right(3)))
  37. def toIor: Ior[A, B]
  38. def toList: List[B]
  39. def toOption: Option[B]
  40. def toString(): String
    Definition Classes
    Any
  41. def toTry(implicit ev: <:<[A, Throwable]): Try[B]
  42. def toValidated: Validated[A, B]
  43. def toValidatedNel[AA >: A]: ValidatedNel[AA, B]

    Returns a cats.data.ValidatedNel representation of this disjunction with the Left value as a single element on the Invalid side of the cats.data.NonEmptyList.

  44. def traverse[F[_], AA >: A, D](f: (B) ⇒ F[D])(implicit F: Applicative[F]): F[Either[AA, D]]
  45. def valueOr[BB >: B](f: (A) ⇒ BB): BB
  46. def withValidated[AA, BB](f: (Validated[A, B]) ⇒ Validated[AA, BB]): Either[AA, BB]

Inherited from AnyVal

Inherited from Any

Ungrouped