sealed trait EitherT[F[+_], +A, +B] extends AnyRef
Represents a computation of type F[A \/ B]
.
Example:
val x: Option[String \/ Int] = Some(\/-(1)) EitherT(x).map(1+).run // Some(\/-(2))
- Source
- EitherT.scala
- Alphabetic
- By Inheritance
- EitherT
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- sealed trait Switching_\/ [X] extends AnyRef
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
+++[AA >: A, BB >: B](x: ⇒ EitherT[F, AA, BB])(implicit M1: Semigroup[BB], M2: Semigroup[AA], F: Apply[F]): EitherT[F, AA, BB]
Sums up values inside disjunction, if both are left or right.
Sums up values inside disjunction, if both are left or right. Returns first left otherwise.
\/-(v1) +++ \/-(v2) → \/-(v1 + v2) \/-(v1) +++ -\/(v2) → -\/(v2) -\/(v1) +++ \/-(v2) → -\/(v1) -\/(v1) +++ -\/(v2) → -\/(v1 + v2)
-
def
:?>>[X](right: ⇒ X): Switching_\/[X]
If this disjunction is right, return the given X value, otherwise, return the X value given to the return value.
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
===[AA >: A, BB >: B](x: EitherT[F, AA, BB])(implicit EA: Equal[AA], EB: Equal[BB], F: Apply[F]): F[Boolean]
Compare two disjunction values for equality.
-
def
app[AA >: A, C](f: ⇒ EitherT[F, AA, (B) ⇒ C])(implicit F: Apply[F]): EitherT[F, AA, C]
Apply a function in the environment of the right of this disjunction.
Apply a function in the environment of the right of this disjunction. Because it runs my
F
even whenf
's\/
fails, it is not consistent withap
. -
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
bimap[C, D](f: (A) ⇒ C, g: (B) ⇒ D)(implicit F: Functor[F]): EitherT[F, C, D]
Binary functor map on this disjunction.
-
def
bitraverse[G[_], C, D](f: (A) ⇒ G[C], g: (B) ⇒ G[D])(implicit F: Traverse[F], G: Applicative[G]): G[EitherT[F, C, D]]
Binary functor traverse on this disjunction.
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
compare[AA >: A, BB >: B](x: EitherT[F, AA, BB])(implicit EA: Order[AA], EB: Order[BB], F: Apply[F]): F[Ordering]
Compare two disjunction values for ordering.
-
def
cozip(implicit Z: Cozip[F]): \/[F[A], F[B]]
Cozip this disjunction on its functor.
-
def
ensure[AA >: A](onLeft: ⇒ AA)(f: (B) ⇒ Boolean)(implicit F: Functor[F]): EitherT[F, AA, B]
Ensures that the right value of this disjunction satisfies the given predicate, or returns left with the given value.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exists(f: (B) ⇒ Boolean)(implicit F: Functor[F]): F[Boolean]
Return
true
if this disjunction is a right value satisfying the given predicate. -
def
filter[AA >: A](p: (B) ⇒ Boolean)(implicit M: Monoid[AA], F: Functor[F]): EitherT[F, AA, B]
Filter on the right of this disjunction.
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flatMap[AA >: A, C](f: (B) ⇒ EitherT[F, AA, C])(implicit F: Monad[F]): EitherT[F, AA, C]
Bind through the right of this disjunction.
- def fold[X](l: (A) ⇒ X, r: (B) ⇒ X)(implicit F: Functor[F]): F[X]
-
def
foldRight[Z](z: ⇒ Z)(f: (B, ⇒ Z) ⇒ Z)(implicit F: Foldable[F]): Z
Fold on the right of this disjunction.
-
def
forall(f: (B) ⇒ Boolean)(implicit F: Functor[F]): F[Boolean]
Return
true
if this disjunction is a left value or the right value satisfies the given predicate. -
def
foreach(f: (B) ⇒ Unit)(implicit F: Each[F]): Unit
Run the side-effect on the right of this disjunction.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
getOrElse[BB >: B](default: ⇒ BB)(implicit F: Functor[F]): F[BB]
Return the right value of this disjunction or the given default if left.
Return the right value of this disjunction or the given default if left. Alias for
|
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isLeft(implicit F: Functor[F]): F[Boolean]
Return
true
if this disjunction is left. -
def
isRight(implicit F: Functor[F]): F[Boolean]
Return
true
if this disjunction is right. -
def
leftMap[C](f: (A) ⇒ C)(implicit F: Functor[F]): EitherT[F, C, B]
Run the given function on the left value.
-
def
map[C](f: (B) ⇒ C)(implicit F: Functor[F]): EitherT[F, A, C]
Map on the right of this disjunction.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
orElse[AA >: A, BB >: B](x: ⇒ EitherT[F, AA, BB])(implicit F: Bind[F]): EitherT[F, AA, BB]
Return this if it is a right, otherwise, return the given value.
Return this if it is a right, otherwise, return the given value. Alias for
|||
-
def
show[AA >: A, BB >: B](implicit SA: Show[AA], SB: Show[BB], F: Functor[F]): F[Cord]
Show for a disjunction value.
-
def
swap(implicit F: Functor[F]): EitherT[F, B, A]
Flip the left/right values in this disjunction.
Flip the left/right values in this disjunction. Alias for
swap
-
def
swapped[AA, BB](k: (\/[B, A]) ⇒ \/[BB, AA])(implicit F: Functor[F]): EitherT[F, AA, BB]
Run the given function on this swapped value.
Run the given function on this swapped value. Alias for
~
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toEither(implicit F: Functor[F]): F[Either[A, B]]
Convert to a core
scala.Either
at your own peril. -
def
toList(implicit F: Functor[F]): F[List[B]]
Return an empty list or list with one element on the right of this disjunction.
-
def
toOption(implicit F: Functor[F]): OptionT[F, B]
Return an empty option or option with one element on the right of this disjunction.
Return an empty option or option with one element on the right of this disjunction. Useful to sweep errors under the carpet.
-
def
toStream(implicit F: Functor[F]): F[Stream[B]]
Return an empty stream or stream with one element on the right of this disjunction.
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
traverse[G[_], AA >: A, C](f: (B) ⇒ G[C])(implicit F: Traverse[F], G: Applicative[G]): G[EitherT[F, AA, C]]
Traverse on the right of this disjunction.
-
def
unary_~(implicit F: Functor[F]): EitherT[F, B, A]
Flip the left/right values in this disjunction.
Flip the left/right values in this disjunction. Alias for
unary_~
-
def
validation(implicit F: Functor[F]): F[Validation[A, B]]
Convert to a validation.
-
def
validationed[AA, BB](k: (Validation[A, B]) ⇒ Validation[AA, BB])(implicit F: Functor[F]): EitherT[F, AA, BB]
Run a validation function and back to disjunction again.
-
def
valueOr[BB >: B](x: (A) ⇒ BB)(implicit F: Functor[F]): F[BB]
Return the right value of this disjunction or run the given function on the left.
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
withFilter[AA >: A](p: (B) ⇒ Boolean)(implicit M: Monoid[AA], F: Functor[F]): EitherT[F, AA, B]
Alias for
filter
.Alias for
filter
.- Since
7.0.2
-
def
|[BB >: B](default: ⇒ BB)(implicit F: Functor[F]): F[BB]
Return the right value of this disjunction or the given default if left.
Return the right value of this disjunction or the given default if left. Alias for
getOrElse
-
def
|||[AA >: A, BB >: B](x: ⇒ EitherT[F, AA, BB])(implicit F: Bind[F]): EitherT[F, AA, BB]
Return this if it is a right, otherwise, return the given value.
Return this if it is a right, otherwise, return the given value. Alias for
orElse
-
def
~[AA, BB](k: (\/[B, A]) ⇒ \/[BB, AA])(implicit F: Functor[F]): EitherT[F, AA, BB]
Run the given function on this swapped value.
Run the given function on this swapped value. Alias for
swapped