Scala Library Documentation
|
|
scala/Either.scala
]
sealed
trait
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
.
Value Summary | |
lazy val
|
isLeft : Boolean |
lazy val
|
isRight : Boolean |
lazy val
|
left : LeftProjection[A, B] |
lazy val
|
right : RightProjection[A, B] |
lazy val
|
swap
: Either[B, A] with Product
|
Method Summary | |
def
|
fold
[X](fa : (A) => X, fb : (B) => X) : X
Deconstruction of the
Either type (in contrast to pattern matching). |
Methods inherited from AnyRef | |
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized |
Methods inherited from Any | |
==, !=, isInstanceOf, asInstanceOf |
Value Details |
lazy val
left : LeftProjection[A, B]
lazy val
right : RightProjection[A, B]
lazy val
isLeft : Boolean
lazy val
isRight : Boolean
Method Details |
Scala Library Documentation
|
|