scala.util.Either.LeftProjection
Projects an Either
into a Left
.
This allows for-comprehensions over Either instances - for example
Continuing the analogy with scala.Option, a LeftProjection
declares that
Left
should be analogous to Some
in some code.
Instance Constructors From scala.util.Either.LeftProjection
new LeftProjection(e: Either[A, B])
(defined at scala.util.Either.LeftProjection)
Value Members From scala.util.Either.LeftProjection
val e: Either[A, B]
(defined at scala.util.Either.LeftProjection)
def exists(p: (A) ⇒ Boolean): Boolean
Returns false
if Right
or returns the result of the application of the given
function to the Left
value.
(defined at scala.util.Either.LeftProjection)
def filter[Y](p: (A) ⇒ Boolean): Option[Either[A, Y]]
Returns None
if this is a Right
or if the given predicate p
does not hold
for the left value, otherwise, returns a Left
.
(defined at scala.util.Either.LeftProjection)
def flatMap[BB >: B, X](f: (A) ⇒ Either[X, BB]): Either[X, BB]
Binds the given function across Left
.
- f
- The function to bind across
Left
.
(defined at scala.util.Either.LeftProjection)
def forall(p: (A) ⇒ Boolean): Boolean
Returns true
if Right
or returns the result of the application of the given
function to the Left
value.
(defined at scala.util.Either.LeftProjection)
def foreach[U](f: (A) ⇒ U): Any
Executes the given side-effecting function if this is a Left
.
- f
- The side-effecting function to execute.
(defined at scala.util.Either.LeftProjection)
def getOrElse[AA >: A](or: ⇒ AA): AA
Returns the value from this Left
or the given argument if this is a Right
.
(defined at scala.util.Either.LeftProjection)
def map[X](f: (A) ⇒ X): Either[X, B]
Maps the function argument through Left
.
(defined at scala.util.Either.LeftProjection)
def toSeq: collection.Seq[A]
Returns a Seq
containing the Left
value if it exists or an empty Seq
if
this is a Right
.
(defined at scala.util.Either.LeftProjection)
Full Source: