Class

cats.syntax

EitherOps

Related Doc: package syntax

Permalink

final class EitherOps[A, B] extends AnyVal

Linear Supertypes
AnyVal, Any
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])

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  4. def ===(that: Either[A, B])(implicit A: Eq[A], B: Eq[B]): Boolean

    Permalink
  5. def ap[C](that: Either[A, (B) ⇒ C]): Either[A, C]

    Permalink
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def bimap[C, D](fa: (A) ⇒ C, fb: (B) ⇒ D): Either[C, D]

    Permalink
  8. final def combine(that: Either[A, B])(implicit B: Semigroup[B]): Either[A, B]

    Permalink

    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(that: Either[A, B])(implicit A: Order[A], B: Order[B]): Int

    Permalink
  10. val eab: Either[A, B]

    Permalink
  11. def ensure(onFailure: ⇒ A)(f: (B) ⇒ Boolean): Either[A, B]

    Permalink
  12. def exists(f: (B) ⇒ Boolean): Boolean

    Permalink
  13. def flatMap[D](f: (B) ⇒ Either[A, D]): Either[A, D]

    Permalink
  14. def foldLeft[C](c: C)(f: (C, B) ⇒ C): C

    Permalink
  15. def foldRight[C](lc: Eval[C])(f: (B, Eval[C]) ⇒ Eval[C]): Eval[C]

    Permalink
  16. def forall(f: (B) ⇒ Boolean): Boolean

    Permalink
  17. def foreach(f: (B) ⇒ Unit): Unit

    Permalink
  18. def getClass(): Class[_ <: AnyVal]

    Permalink
    Definition Classes
    AnyVal → Any
  19. def getOrElse(default: ⇒ B): B

    Permalink
  20. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  21. def leftMap[C](f: (A) ⇒ C): Either[C, B]

    Permalink
  22. def map[C](f: (B) ⇒ C): Either[A, C]

    Permalink
  23. def map2Eval[C, Z](fc: Eval[Either[A, C]])(f: (B, C) ⇒ Z): Eval[Either[A, Z]]

    Permalink
  24. def orElse[C](fallback: ⇒ Either[C, B]): Either[C, B]

    Permalink
  25. def partialCompare(that: Either[A, B])(implicit A: PartialOrder[A], B: PartialOrder[B]): Double

    Permalink
  26. def recover(pf: PartialFunction[A, B]): Either[A, B]

    Permalink
  27. def recoverWith(pf: PartialFunction[A, Either[A, B]]): Either[A, B]

    Permalink
  28. def show(implicit A: Show[A], B: Show[B]): String

    Permalink
  29. def to[F[_]](implicit F: Alternative[F]): F[B]

    Permalink
  30. def toEitherT[F[_]](implicit arg0: Applicative[F]): EitherT[F, A, B]

    Permalink

    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)))
  31. def toIor: Ior[A, B]

    Permalink
  32. def toList: List[B]

    Permalink
  33. def toOption: Option[B]

    Permalink
  34. def toString(): String

    Permalink
    Definition Classes
    Any
  35. def toTry(implicit ev: <:<[A, Throwable]): Try[B]

    Permalink
  36. def toValidated: Validated[A, B]

    Permalink
  37. def toValidatedNel: ValidatedNel[A, B]

    Permalink

    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.

  38. def traverse[F[_], D](f: (B) ⇒ F[D])(implicit F: Applicative[F]): F[Either[A, D]]

    Permalink
  39. def valueOr(f: (A) ⇒ B): B

    Permalink
  40. def withValidated[AA, BB](f: (Validated[A, B]) ⇒ Validated[AA, BB]): Either[AA, BB]

    Permalink

Inherited from AnyVal

Inherited from Any

Ungrouped