|
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). |
def
|
isLeft
: Boolean
Returns
true if this is a Left, false otherwise. |
def
|
isRight
: Boolean
Returns
true if this is a Right, false otherwise. |
def
|
left
: LeftProjection[A, B]
Projects this
Either as a Left. |
def
|
right
: RightProjection[A, B]
Projects this
Either as a Right. |
def
|
swap
: Either[B, A] with Product
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.
def
isLeft : Boolean
true if this is a Left, false otherwise.
def
isRight : Boolean
true if this is a Right, false otherwise.|
Scala Library
|
|