|
Scala Library
|
|
scala/Either.scala]
sealed abstract
class
Either[+A, +B]
extends AnyRef
The Either type represents a value of one of two possible
types (a disjoint union). The data constructors Left and
Right represent the two possible values.
The Either type is often used as an alternative to
scala.Option where Left represents failure
(by convention) and Right is akin to Some.
| Method Summary | |
def
|
fold
[X](fa : (A) => X, fb : (B) => X) : X
Deconstruction of the
Either type (in contrast to pattern matching). |
abstract def
|
isLeft
: Boolean
Returns
true if this is a Left, false otherwise. |
abstract def
|
isRight
: Boolean
Returns
true if this is a Right, false otherwise. |
def
|
joinLeft
[A1 >: A, B1 >: B, C](implicit ev : <:<[A1, Either[C, B1]]) : Either[C, B1]
Joins an
Either through Left. |
def
|
joinRight
[A1 >: A, B1 >: B, C](implicit ev : <:<[B1, Either[A1, C]]) : Either[A1, C]
Joins an
Either through Right. |
def
|
left
: LeftProjection[A, B]
Projects this
Either as a Left. |
def
|
right
: RightProjection[A, B]
Projects this
Either as a Right. |
def
|
swap
: Product with Either[B, A]
If this is a
Left, then return the left value in Right or vice versa. |
| Methods inherited from AnyRef | |
| getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
| Methods inherited from Any | |
| ==, !=, isInstanceOf, asInstanceOf |
| Method Details |
def
left : LeftProjection[A, B]
Either as a Left.
def
right : RightProjection[A, B]
Either as a Right.Either type (in contrast to pattern matching).Left, then return the left value in Right or vice versa.Either through Right.Either through Left.abstract
def
isLeft : Boolean
true if this is a Left, false otherwise.abstract
def
isRight : Boolean
true if this is a Right, false otherwise.|
Scala Library
|
|