Either<L, R> class
abstract
One of the popular examples of Coproduct2 type.
It represents a value that can be either of type L
or of type R
.
Usually L
is assumed to be of Error type and R
of Right type, e.g.
in pseudo-code:
type Result<T> = Either<Exception, T>
- Implemented types
-
- Coproduct2<
L, R>
- Coproduct2<
- Available Extensions
Constructors
- Either.left(L value)
-
constfactory
- Either.right(R value)
-
constfactory
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
combine<
R2> (Either< L, R2> other) → Either<L, Product2< R, R2> > -
flatMap<
T> (Either< L, T> f(R)) → Either<L, T> -
fold<
T> (T onLeft(L), T onRight(R)) → T -
override
-
isLeft(
) → bool -
isRight(
) → bool -
map<
T> (T f(R)) → Either< L, T> -
mapLeft<
L1> (L1 f(L)) → Either< L1, R> -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited