task_either library

Classes

TaskEither<L, R>
Represents a Task that resolves to an Either. The underlying type is a Function that returns a FutureOr<Either>.

Functions

alt<L, R>(TaskEither<L, R> orElse(L left)) TaskEither<L, R> Function(TaskEither<L, R> taskEither)
If the given TaskEither is an Left, then unwrap the result and transform it into an alternative TaskEither.
as<L, R1, R2>(R2 r2) TaskEither<L, R2> Function(TaskEither<L, R1> task)
asUnit<L, R>(TaskEither<L, R> task) TaskEither<L, Unit>
call<L, R1, R2>(TaskEither<L, R2> chain) TaskEither<L, R2> Function(TaskEither<L, R1> task)
chainNullableK<L, R, R2>(R2? f(R right), L onNone(R right)) TaskEither<L, R2> Function(TaskEither<L, R> taskEither)
Chainable variant of fromNullableK.
chainTryCatchK<L, R, R2>(FutureOr<R2> task(R value), L onError(dynamic err, StackTrace stackTrace)) TaskEither<L, R2> Function(TaskEither<L, R> taskEither)
A chainable variant of tryCatchK.
delay<L, R>(Duration d) TaskEither<L, R> Function(TaskEither<L, R>)
Pause execution of the task by the given Duration.
Do<L, A>(DoFunction<L, A> f) TaskEither<L, A>
filter<L, R>(bool predicate(R value), L orElse(R value)) TaskEither<L, R> Function(TaskEither<L, R> taskEither)
Conditionally filter the TaskEither, transforming Right values to Left.
flatMap<L, R, R2>(TaskEither<L, R2> f(R value)) TaskEither<L, R2> Function(TaskEither<L, R> taskEither)
If the given TaskEither is an Right, then unwrap the result and transform it into another TaskEither.
flatMapFirst<L, R>(TaskEither<L, dynamic> f(R value)) TaskEither<L, R> Function(TaskEither<L, R> taskEither)
If the given TaskEither is an Right, then unwrap the result and transform it into another TaskEither - but only keep Left results.
flatMapTuple2<E, A, B>(TaskEither<E, B> f(A a)) TaskEither<E, dynamic> Function(TaskEither<E, A>)
flatMapTuple3<E, A, B, C>(TaskEither<E, C> f(dynamic a)) TaskEither<E, Tuple3<A, B, C>> Function(TaskEither<E, dynamic>)
fold<L, R, A>(A onLeft(L left), A onRight(R right)) Task<A> Function(TaskEither<L, R> taskEither)
Unwraps the Either value, returning a Task that resolves to the result.
fromEither<L, R>(Either<L, R> either) TaskEither<L, R>
Returns a TaskEither that resolves to the given Either.
fromNullable<L, R>(R? value, L onNone()) TaskEither<L, R>
Create a TaskEither from a nullable value. onNone is executed if the given value is null.
fromNullableK<A, L, R>(R? f(A value), L onNone(A value)) TaskEither<L, R> Function(A value)
Create a TaskEither from a nullable value. onNone is executed if the value (given to the returned function) is null.
fromOption<L, R>(L onNone()) TaskEither<L, R> Function(Option<R> option)
Create a TaskEither from an Option. If it is None, then the TaskEither will resolve to a Left containing the result from executing onNone.
fromPredicate<L, R>(R r, bool f(R r), L orElse(R r)) TaskEither<L, R>
If the function returns true, then the resolved Either will be a Right containing the given value.
fromPredicateK<L, R>(bool f(R r), L orElse(R r)) TaskEither<L, R> Function(R r)
If the function returns true, then the resolved Either will be a Right containing the given value.
fromTask<L, R>(Task<R> fa) TaskEither<L, R>
Transforms a Task into a TaskEither, wrapping the result in an Right.
getOrElse<L, R>(R onLeft(L left)) Task<R> Function(TaskEither<L, R> taskEither)
Unwrap the Either value. Resolves to the unwrapped Right value, but if the TaskEither is an Left, the onLeft callback determines the fallback value.
left<L, R>(L a) TaskEither<L, R>
Create a TaskEither that resolves to an Left.
makeDo<L>() TaskEither<L, A> Function<A>(DoFunction<L, A> )
Create a Do notation factory for the given generics
map<L, R, R2>(R2 f(R value)) TaskEither<L, R2> Function(TaskEither<L, R> taskEither)
Transform a TaskEither's value if it is Right.
mapLeft<L1, L2, R>(L2 f(L1 value)) TaskEither<L2, R> Function(TaskEither<L1, R> taskEither)
Transform a TaskEither's value if it is Left.
orElse<L, R>(TaskEither<L, R> orElse) TaskEither<L, R> Function(TaskEither<L, R> taskEither)
Similar to alt, but the alternative TaskEither is given directly.
pure<L, R, R2>(R2 a) TaskEither<L, R2> Function(TaskEither<L, R> taskEither)
Replace the TaskEither with one that resolves to an Right containing the given value.
Create a TaskEither that resolves to an Right.
sequence<L, A>(Iterable<TaskEither<L, A>> arr) TaskEither<L, IList<A>>
sequenceSeq<L, A>(Iterable<TaskEither<L, A>> arr) TaskEither<L, IList<A>>
tap<L, R>(FutureOr<void> f(R value)) TaskEither<L, R> Function(TaskEither<L, R> taskEither)
Run a side effect on a Right value. The side effect can optionally return a Future.
tapLeft<L, R>(FutureOr<void> f(L value)) TaskEither<L, R> Function(TaskEither<L, R> taskEither)
Run a side effect on a Left value. The side effect can optionally return a Future.
toFuture<L, R>(TaskEither<L, R> taskEither) Future<R>
Convert a TaskEither into a Future, that throws an error on Left.
toFutureVoid<L>(void onLeft(L value)) Future<void> Function(TaskEither<L, dynamic> taskEither)
Convert a TaskEither into a Future<void>, that runs the side effect on Left.
traverseIterable<L, A, B>(TaskEither<L, B> f(A a)) TaskEither<L, IList<B>> Function(Iterable<A>)
traverseIterableSeq<L, A, B>(TaskEither<L, B> f(A a)) TaskEither<L, IList<B>> Function(Iterable<A>)
tryCatch<L, R>(Lazy<FutureOr<R>> task, L onError(dynamic err, StackTrace stackTrace)) TaskEither<L, R>
Runs the given task, and returns the result as an Right. If it throws an error, the the error is passed to onError, which determines the Left value.
tryCatchK<A, L, R>(FutureOr<R> task(A value), L onError(dynamic err, StackTrace stackTrace)) TaskEither<L, R> Function(A value)
A variant of tryCatch that accepts an external parameter.
tryCatchK2<A, B, L, R>(FutureOr<R> task(A a, B b), L onError(dynamic err, StackTrace stackTrace)) TaskEither<L, R> Function(A a, B b)
A variant of tryCatch that accepts two external parameters.
unit<L>() TaskEither<L, Unit>
zipRight<L, R1, R2>(TaskEither<L, R2> chain) TaskEither<L, R2> Function(TaskEither<L, R1> task)

Typedefs

DoFunction<L, A> = Future<A> Function(_DoAdapter<L> $)