object EitherT extends EitherTInstances with Serializable
- Source
- EitherT.scala
- Alphabetic
- By Inheritance
- EitherT
- Serializable
- Serializable
- EitherTInstances
- EitherTInstances1
- EitherTInstances2
- EitherTInstances3
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
accumulatingParallel[M[_], E](implicit arg0: Semigroup[E], P: Parallel[M]): Aux[[γ$23$]EitherT[M, E, γ$23$], [γ$24$]Nested[Parallel.F, [β$22$]Validated[E, β$22$], γ$24$]]
An alternative Parallel implementation which merges the semantics of the outer Parallel (the F[_] effect) with the effects of the inner one (the Either).
An alternative Parallel implementation which merges the semantics of the outer Parallel (the F[_] effect) with the effects of the inner one (the Either). The inner Parallel has the semantics of Validated, while the outer has the semantics of parallel evaluation (in most cases). The default Parallel for EitherT, when the nested F also has a Parallel, is to strictly take the semantics of the nested F and to short-circuit any lefts (often, errors) in a left-to-right fashion, mirroring the semantics of Applicative on EitherT. This instance is different in that it will not short-circuit but instead accumulate all lefts according to the supplied Semigroup, similar to Validated.
implicit val p: Parallel[EitherT[IO, Chain[Error], *]] = EitherT.accumulatingParallel val a = EitherT(IO(Chain(error1).asLeft[Unit])) val b = EitherT(IO(Chain(error2).asLeft[Unit])) (a, b).parTupled // => EitherT(IO(Chain(error1, error2).asLeft[Unit]))
- Definition Classes
- EitherTInstances
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
implicit
def
catsDataBifunctorForEitherT[F[_]](implicit F: Functor[F]): Bifunctor[[β$14$, γ$15$]EitherT[F, β$14$, γ$15$]]
- Definition Classes
- EitherTInstances
-
implicit
def
catsDataBitraverseForEitherT[F[_]](implicit F: Traverse[F]): Bitraverse[[β$69$, γ$70$]EitherT[F, β$69$, γ$70$]]
- Definition Classes
- EitherTInstances1
-
implicit
def
catsDataDeferForEitherT[F[_], L](implicit F: Defer[F]): Defer[[γ$17$]EitherT[F, L, γ$17$]]
- Definition Classes
- EitherTInstances
-
implicit
def
catsDataEqForEitherT[F[_], L, R](implicit F: Eq[F[Either[L, R]]]): Eq[EitherT[F, L, R]]
- Definition Classes
- EitherTInstances2
-
implicit
def
catsDataFoldableForEitherT[F[_], L](implicit F: Foldable[F]): Foldable[[γ$68$]EitherT[F, L, γ$68$]]
- Definition Classes
- EitherTInstances1
-
implicit
def
catsDataFunctorForEitherT[F[_], L](implicit F0: Functor[F]): Functor[[γ$99$]EitherT[F, L, γ$99$]]
- Definition Classes
- EitherTInstances3
-
implicit
def
catsDataMonadErrorFForEitherT[F[_], E, L](implicit FE0: MonadError[F, E]): MonadError[[γ$97$]EitherT[F, L, γ$97$], E]
Monad error instance for recovering errors in F instead of the underlying Either.
Monad error instance for recovering errors in F instead of the underlying Either.
scala> import cats.data.EitherT scala> import cats.MonadError scala> import cats.instances.option._ scala> val noInt: Option[Either[String, Int]] = None scala> val et = EitherT[Option, String, Int](noInt) scala> val me = MonadError[EitherT[Option, String, *], Unit] scala> me.recover(et) { case () => 1 } res0: cats.data.EitherT[Option,String,Int] = EitherT(Some(Right(1)))
- Definition Classes
- EitherTInstances2
-
implicit
def
catsDataMonadErrorForEitherT[F[_], L](implicit F0: Monad[F]): MonadError[[γ$71$]EitherT[F, L, γ$71$], L]
- Definition Classes
- EitherTInstances1
-
implicit
def
catsDataOrderForEitherT[F[_], L, R](implicit F: Order[F[Either[L, R]]]): Order[EitherT[F, L, R]]
- Definition Classes
- EitherTInstances
-
implicit
def
catsDataParallelForEitherTWithParallelEffect2[M[_], E](implicit P: Parallel[M]): Aux[[γ$46$]EitherT[M, E, γ$46$], [γ$47$]Nested[Parallel.F, [β$45$]Either[E, β$45$], γ$47$]]
- Definition Classes
- EitherTInstances
-
implicit
def
catsDataParallelForEitherTWithSequentialEffect[M[_], E](implicit arg0: Monad[M], arg1: Semigroup[E]): Aux[[γ$73$]EitherT[M, E, γ$73$], [γ$74$]Nested[M, [β$72$]Validated[E, β$72$], γ$74$]]
- Definition Classes
- EitherTInstances1
-
implicit
def
catsDataPartialOrderForEitherT[F[_], L, R](implicit F: PartialOrder[F[Either[L, R]]]): PartialOrder[EitherT[F, L, R]]
- Definition Classes
- EitherTInstances1
-
implicit
def
catsDataSemigroupKForEitherT[F[_], L](implicit F0: Monad[F]): SemigroupK[[γ$98$]EitherT[F, L, γ$98$]]
- Definition Classes
- EitherTInstances2
-
implicit
def
catsDataShowForEitherT[F[_], L, R](implicit sh: Show[F[Either[L, R]]]): Show[EitherT[F, L, R]]
- Definition Classes
- EitherTInstances
-
implicit
def
catsDataTraverseForEitherT[F[_], L](implicit FF: Traverse[F]): Traverse[[γ$16$]EitherT[F, L, γ$16$]]
- Definition Classes
- EitherTInstances
-
implicit
def
catsMonoidForEitherT[F[_], L, A](implicit F: Monoid[F[Either[L, A]]]): Monoid[EitherT[F, L, A]]
- Definition Classes
- EitherTInstances
-
implicit
def
catsSemigroupForEitherT[F[_], L, A](implicit F: Semigroup[F[Either[L, A]]]): Semigroup[EitherT[F, L, A]]
- Definition Classes
- EitherTInstances1
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native() @IntrinsicCandidate()
-
final
def
cond[F[_]]: CondPartiallyApplied[F]
If the condition is satisfied, return the given
A
inRight
lifted into the specifiedApplicative
, otherwise, return the givenE
inLeft
lifted into the specifiedApplicative
.If the condition is satisfied, return the given
A
inRight
lifted into the specifiedApplicative
, otherwise, return the givenE
inLeft
lifted into the specifiedApplicative
.scala> import cats.Id scala> import cats.data.EitherT scala> val userInput = "hello world" scala> EitherT.cond[Id]( | userInput.forall(_.isDigit) && userInput.size == 10, | userInput, | "The input does not look like a phone number") res0: EitherT[Id, String, String] = EitherT(Left(The input does not look like a phone number))
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
fromEither[F[_]]: FromEitherPartiallyApplied[F]
Transforms an
Either
into anEitherT
, lifted into the specifiedApplicative
.Transforms an
Either
into anEitherT
, lifted into the specifiedApplicative
.Note: The return type is a FromEitherPartiallyApplied[F], which has an apply method on it, allowing you to call fromEither like this:
scala> import cats.implicits._ scala> val t: Either[String, Int] = Either.right(3) scala> EitherT.fromEither[Option](t) res0: EitherT[Option, String, Int] = EitherT(Some(Right(3)))
The reason for the indirection is to emulate currying type parameters.
-
final
def
fromOption[F[_]]: FromOptionPartiallyApplied[F]
Transforms an
Option
into anEitherT
, lifted into the specifiedApplicative
and using the second argument if theOption
is aNone
.Transforms an
Option
into anEitherT
, lifted into the specifiedApplicative
and using the second argument if theOption
is aNone
.scala> import cats.implicits._ scala> val o: Option[Int] = None scala> EitherT.fromOption[List](o, "Answer not known.") res0: EitherT[List, String, Int] = EitherT(List(Left(Answer not known.))) scala> EitherT.fromOption[List](Some(42), "Answer not known.") res1: EitherT[List, String, Int] = EitherT(List(Right(42)))
-
final
def
fromOptionF[F[_], E, A](fopt: F[Option[A]], ifNone: ⇒ E)(implicit F: Functor[F]): EitherT[F, E, A]
Transforms an
F[Option]
into anEitherT
, using the second argument if theOption
is aNone
.Transforms an
F[Option]
into anEitherT
, using the second argument if theOption
is aNone
.scala> import cats.implicits._ scala> val o: Option[Int] = None scala> EitherT.fromOptionF(List(o), "Answer not known.") res0: EitherT[List, String, Int] = EitherT(List(Left(Answer not known.))) scala> EitherT.fromOptionF(List(Option(42)), "Answer not known.") res1: EitherT[List, String, Int] = EitherT(List(Right(42)))
-
final
def
fromOptionM[F[_], E, A](fopt: F[Option[A]], ifNone: ⇒ F[E])(implicit F: Monad[F]): EitherT[F, E, A]
Similar to
fromOptionF
but the left is carried from monadicF[_]
context when the option isNone
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
left[B]: LeftPartiallyApplied[B]
Creates a left version of
EitherT[F, A, B]
from aF[A]
Creates a left version of
EitherT[F, A, B]
from aF[A]
scala> import cats.data.EitherT scala> import cats.implicits._ scala> EitherT.left[Int](Option("err")) res0: cats.data.EitherT[Option,String,Int] = EitherT(Some(Left(err)))
-
final
def
leftT[F[_], B]: LeftTPartiallyApplied[F, B]
Creates a left version of
EitherT[F, A, B]
from aA
Creates a left version of
EitherT[F, A, B]
from aA
scala> import cats.data.EitherT scala> import cats.implicits._ scala> EitherT.leftT[Option, Int]("err") res0: cats.data.EitherT[Option,String,Int] = EitherT(Some(Left(err)))
-
final
def
liftAttemptK[F[_], E](implicit F: ApplicativeError[F, E]): ~>[F, [γ$12$]EitherT[F, E, γ$12$]]
Lifts an effect into EitherT, catching all errors from the effect and lifting them into EitherT's error channel.
Lifts an effect into EitherT, catching all errors from the effect and lifting them into EitherT's error channel.
scala> import cats._, data._, implicits._ scala> val a: Option[Int] = None scala> val b: EitherT[Option, Unit, Int] = EitherT.liftAttemptK[Option, Unit].apply(a) scala> b.value res0: Option[Either[Unit, Int]] = Some(Left(())) scala> val a2: Option[Int] = Some(42) scala> val b2: EitherT[Option, Unit, Int] = EitherT.liftAttemptK[Option, Unit].apply(a2) scala> b2.value res1: Option[Either[Unit, Int]] = Some(Right(42))
-
final
def
liftF[F[_], A, B](fb: F[B])(implicit F: Functor[F]): EitherT[F, A, B]
Alias for right
Alias for right
scala> import cats.data.EitherT scala> import cats.implicits._ scala> val o: Option[Int] = Some(3) scala> val n: Option[Int] = None scala> EitherT.liftF(o) res0: cats.data.EitherT[Option,Nothing,Int] = EitherT(Some(Right(3))) scala> EitherT.liftF(n) res1: cats.data.EitherT[Option,Nothing,Int] = EitherT(None)
-
final
def
liftK[F[_], A](implicit F: Functor[F]): ~>[F, [γ$10$]EitherT[F, A, γ$10$]]
Same as liftF, but expressed as a FunctionK for use with mapK
Same as liftF, but expressed as a FunctionK for use with mapK
scala> import cats._, data._, implicits._ scala> val a: OptionT[Eval, Int] = 1.pure[OptionT[Eval, *]] scala> val b: OptionT[EitherT[Eval, String, *], Int] = a.mapK(EitherT.liftK) scala> b.value.value.value res0: Either[String,Option[Int]] = Right(Some(1))
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @IntrinsicCandidate()
-
final
def
pure[F[_], A]: PurePartiallyApplied[F, A]
Creates a new
EitherT[F, A, B]
from aB
Creates a new
EitherT[F, A, B]
from aB
scala> import cats.data.EitherT scala> import cats.implicits._ scala> EitherT.pure[Option, String](3) res0: cats.data.EitherT[Option,String,Int] = EitherT(Some(Right(3)))
-
final
def
right[A]: RightPartiallyApplied[A]
Creates a right version of
EitherT[F, A, B]
from aF[B]
Creates a right version of
EitherT[F, A, B]
from aF[B]
scala> import cats.data.EitherT scala> import cats.implicits._ scala> EitherT.right[String](Option(3)) res0: cats.data.EitherT[Option,String,Int] = EitherT(Some(Right(3)))
-
final
def
rightT[F[_], A]: PurePartiallyApplied[F, A]
Alias for pure
Alias for pure
scala> import cats.data.EitherT scala> import cats.implicits._ scala> EitherT.rightT[Option, String](3) res0: cats.data.EitherT[Option,String,Int] = EitherT(Some(Right(3)))
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
Deprecated Value Members
-
def
catsDataParallelForEitherTWithParallelEffect[M[_], E](implicit arg0: Semigroup[E], P: Parallel[M]): Aux[[γ$20$]EitherT[M, E, γ$20$], [γ$21$]Nested[Parallel.F, [β$19$]Validated[E, β$19$], γ$21$]]
- Definition Classes
- EitherTInstances
- Annotations
- @deprecated
- Deprecated
(Since version 2.4.0) This implicit provides inconsistent effect layering semantics; see #3776 for more discussion
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] ) @Deprecated
- Deprecated
-
final
def
liftT[F[_], A, B](fb: F[B])(implicit F: Functor[F]): EitherT[F, A, B]
- Annotations
- @deprecated
- Deprecated
(Since version 1.0.0-RC1) Use EitherT.liftF.