ReaderTaskEither<E, L, R> class final

ReaderTaskEither<E, L, R> represents an asynchronous computation (Task) that either yields a value of type R or fails yielding an error of type L (Either), that allows to read values from a dependency/context E (Reader).

ReaderTaskEither models a complete program using Reader for dependency injection, Task to perform asynchronous computation, and Either to handle errors.

Inheritance
  • Object
  • HKT3<_ReaderTaskEitherHKT, E, L, R>
  • ReaderTaskEither
Mixed in types
  • Functor3<_ReaderTaskEitherHKT, E, L, R>
  • Applicative3<_ReaderTaskEitherHKT, E, L, R>
  • Monad3<_ReaderTaskEitherHKT, E, L, R>
  • Alt3<_ReaderTaskEitherHKT, E, L, R>

Constructors

ReaderTaskEither(Future<Either<L, R>> _run(E env))
Build a ReaderTaskEither from a function returning a Future<Either<L, R>>.
const
ReaderTaskEither.asks(R f(E))
Extract a value A given the current dependency E.
factory
ReaderTaskEither.Do(DoFunctionReaderTaskEither<E, L, R> f)
Initialize a Do Notation chain.
factory
ReaderTaskEither.flatten(ReaderTaskEither<E, L, ReaderTaskEither<E, L, R>> readerTaskEither)
Flat a ReaderTaskEither contained inside another ReaderTaskEither to be a single ReaderTaskEither.
factory
ReaderTaskEither.fromEither(Either<L, R> either)
Build a ReaderTaskEither that returns either.
factory
ReaderTaskEither.fromIO(IO<R> io)
Build a ReaderTaskEither that returns a Right containing the result of running io.
factory
ReaderTaskEither.fromIOEither(IOEither<L, R> io)
Build a ReaderTaskEither that returns a Right containing the result of running io.
factory
ReaderTaskEither.fromIOOption(IOOption<R> io, L onNone())
Build a ReaderTaskEither that returns a Right containing the result of running io, or the result of onNone if io is Left.
factory
ReaderTaskEither.fromNullable(R? r, L onNull())
If r is null, then return the result of onNull in Left. Otherwise return Right(r).
factory
ReaderTaskEither.fromNullableAsync(R? r, Task<L> onNull)
If r is null, then return the result of onNull in Left. Otherwise return Right(r).
factory
ReaderTaskEither.fromOption(Option<R> option, L onNone())
Build a ReaderTaskEither from option.
factory
ReaderTaskEither.fromReader(Reader<E, R> reader)
Build a ReaderTaskEither that returns a Right containing the result of running reader.
factory
ReaderTaskEither.fromTask(Task<R> task)
Build a ReaderTaskEither that returns a Right containing the result of running task.
factory
ReaderTaskEither.fromTaskEither(TaskEither<L, R> task)
Build a ReaderTaskEither that returns a Right containing the result of running task.
factory
ReaderTaskEither.fromTaskOption(TaskOption<R> task, L onNone())
Build a ReaderTaskEither that returns a Right containing the result of running task, or the result of onNone if task is Left.
factory
ReaderTaskEither.left(L left)
Build a ReaderTaskEither that returns a Left(left).
factory
ReaderTaskEither.leftReader(Reader<E, L> reader)
Build a ReaderTaskEither from a Reader<E, L>.
factory
ReaderTaskEither.leftTask(Task<L> task)
Build a ReaderTaskEither that returns a Left containing the result of running task.
factory
ReaderTaskEither.of(R r)
Build a ReaderTaskEither that returns a Right(r).
factory
ReaderTaskEither.tryCatch(Future<R> run(E), L onError(Object error, StackTrace stackTrace))
Execute an async function (Future) and convert the result to Either:
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

alt(covariant ReaderTaskEither<E, L, R> orElse()) ReaderTaskEither<E, L, R>
When this ReaderTaskEither returns Right, then return the current ReaderTaskEither. Otherwise return the result of orElse.
override
andThen<C>(covariant ReaderTaskEither<E, L, C> then()) ReaderTaskEither<E, L, C>
If running this ReaderTaskEither returns Right, then return the result of calling then. Otherwise return Left.
override
ap<C>(covariant ReaderTaskEither<E, L, C Function(R r)> a) ReaderTaskEither<E, L, C>
Apply the function contained inside a to change the value on the Right from type R to a value of type C.
override
bimap<C, D>(C mLeft(L l), D mRight(R r)) ReaderTaskEither<E, C, D>
Define two functions to change both the Left and Right value of the ReaderTaskEither.
call<C>(covariant ReaderTaskEither<E, L, C> chain) ReaderTaskEither<E, L, C>
Chain multiple functions having the same left type L.
override
chainFirst<N1>(covariant ReaderTaskEither<E, L, N1> chain(R p1)) ReaderTaskEither<E, L, R>
override
filterOrElse(bool f(R r), L onFalse(R r)) ReaderTaskEither<E, L, R>
If f applied on this ReaderTaskEither as Right returns true, then return this ReaderTaskEither. If it returns false, return the result of onFalse in a Left.
flatMap<C>(covariant ReaderTaskEither<E, L, C> f(R r)) ReaderTaskEither<E, L, C>
Used to chain multiple functions that return a ReaderTaskEither.
override
flatMapTaskEither<C>(TaskEither<L, C> f(R r)) ReaderTaskEither<E, L, C>
Chain a function that takes the current value R inside this TaskEither and returns Either.
getOrElse(R orElse(L left)) ReaderTask<E, R>
Convert this ReaderTaskEither to a ReaderTask.
map<C>(C f(R r)) ReaderTaskEither<E, L, C>
If running this ReaderTaskEither returns Right, then change its value from type R to type C using function f.
override
map2<N1, N2>(covariant ReaderTaskEither<E, L, N1> m1, N2 f(R p1, N1 p2)) ReaderTaskEither<E, L, N2>
override
map3<N1, N2, N3>(covariant ReaderTaskEither<E, L, N1> m1, covariant ReaderTaskEither<E, L, N2> m2, N3 f(R p1, N1 p2, N2 p3)) ReaderTaskEither<E, L, N3>
override
mapLeft<C>(C f(L l)) ReaderTaskEither<E, C, R>
Change the value in the Left of ReaderTaskEither.
match<B>(B onLeft(L left), B onRight(R right)) ReaderTask<E, B>
Pattern matching to convert a ReaderTaskEither to a ReaderTask.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
orElse<TL>(ReaderTaskEither<E, TL, R> orElse(L l)) ReaderTaskEither<E, TL, R>
When this ReaderTaskEither returns a Left then return the result of orElse. Otherwise return this ReaderTaskEither.
pure<C>(C a) ReaderTaskEither<E, L, C>
Returns a ReaderTaskEither that returns a Right(a).
override
run(E env) Future<Either<L, R>>
Run the task given E and return a Future<Either<L, R>>.
swap() ReaderTaskEither<E, R, L>
Change this ReaderTaskEither from ReaderTaskEither<L, R> to ReaderTaskEither<R, L>.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

ask<E, L>() ReaderTaskEither<E, L, E>
Read the current dependency E.