Either<L, R> class
Classe che permette di avere un risultato di un tipo oppure di un altro. Un left solitamente va messo un risultato di errore
Constructors
- Either.left(L left)
- Inizializza l'oggetto con il tipo L
- Either.right(R right)
- Inizializza l'oggetto con il tipo R
Properties
Methods
-
biMap<
LL, RR> (LL lf(L l), RR rf(R r)) → Either< LL, RR> -
Come la
map
, con la differenza che chiama la lf o rf in base al tipo contenuto. Quindi non considera L come errore -
bind<
RR> (Either< L, RR> f(R r)) → Either<L, RR> -
Concatena il risultato Either con un'altra funzione che ritorna un
Either
. Se Either contiene L, allora la funzione non viene chiamata (L è considerato in stato di errore) e ritorna semplicemente l'Either che contiene L -
fold<
TR> (TR leftF(L l), TR rightF(R r)) → TR -
Estrae il tipo contenuto da
Either
(L o R) e chiama la funzione corrispondente che dovranno essere passate come closures -
foreEach(
void f(R r)) → Either< L, void> -
map<
RR> (RR f(R r)) → Either< L, RR> - Concatena il risultato Either con un'altra funzione che non ritorna un Either. Se Either contiene L, allora la funzione non viene chiamata (L è considerato in stato di errore) e ritorna semplicemente l'Either che contiene L
-
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