Class

cats.syntax

EitherOps

Related Doc: package syntax

Permalink

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])

    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 ===[AA >: A, BB >: B](that: Either[AA, BB])(implicit AA: Eq[AA], BB: Eq[BB]): Boolean

    Permalink
  5. def ap[AA >: A, BB >: B, C](that: Either[AA, (BB) ⇒ C]): Either[AA, 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[AA >: A, BB >: B](that: Either[AA, BB])(implicit BB: Semigroup[BB]): Either[AA, BB]

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

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

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

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

    Permalink
  13. def flatMap[AA >: A, D](f: (B) ⇒ Either[AA, D]): Either[AA, 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[BB >: B](default: ⇒ BB): BB

    Permalink
  20. final def isInstanceOf[T0]: Boolean

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

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

    Permalink
  23. def liftTo[F[_]](implicit F: ApplicativeError[F, _ >: A]): F[B]

    Permalink

    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]

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

    Permalink
  26. def orElse[C, BB >: B](fallback: ⇒ Either[C, BB]): Either[C, BB]

    Permalink
  27. def partialCompare[AA >: A, BB >: B](that: Either[AA, BB])(implicit AA: PartialOrder[AA], BB: PartialOrder[BB]): Double

    Permalink
  28. def raiseOrPure[F[_]](implicit ev: ApplicativeError[F, A]): F[B]

    Permalink
  29. def recover[BB >: B](pf: PartialFunction[A, BB]): Either[A, BB]

    Permalink
  30. def recoverWith[AA >: A, BB >: B](pf: PartialFunction[A, Either[AA, BB]]): Either[AA, BB]

    Permalink
  31. def show[AA >: A, BB >: B](implicit AA: Show[AA], BB: Show[BB]): String

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

    Permalink
  33. def toEitherNec[AA >: A]: EitherNec[AA, B]

    Permalink
  34. def toEitherNel[AA >: A]: EitherNel[AA, B]

    Permalink
  35. def toEitherNes[AA >: A](implicit O: Order[AA]): EitherNes[AA, B]

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

    Permalink
  38. def toList: List[B]

    Permalink
  39. def toOption: Option[B]

    Permalink
  40. def toString(): String

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

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

    Permalink
  43. def toValidatedNel[AA >: A]: ValidatedNel[AA, 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.

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

    Permalink
  45. def valueOr[BB >: B](f: (A) ⇒ BB): BB

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

    Permalink

Inherited from AnyVal

Inherited from Any

Ungrouped