ReaderTask<E, A> class
final
ReaderTask represents an asynchronous computation that yields a value of type A
from a context of type E
and never fails.
If you want to represent an asynchronous computation that may fail, see ReaderTaskEither.
- Inheritance
- Mixed-in types
-
- Functor2<
_ReaderTaskHKT, E, A> - Applicative2<
_ReaderTaskHKT, E, A> - Monad2<
_ReaderTaskHKT, E, A>
- Functor2<
Constructors
-
ReaderTask(Future<
A> _run(E env)) -
Build a ReaderTask from a function returning a Future given
E
.const - ReaderTask.asks(A f(E))
-
Extract a value
A
given the current dependencyE
.factory -
ReaderTask.Do(DoFunctionReaderTask<
E, A> f) -
Initialize a Do Notation chain.
factory
-
ReaderTask.flatten(ReaderTask<
E, ReaderTask< task)E, A> > -
Flat a ReaderTask contained inside another ReaderTask to be a single ReaderTask.
factory
- ReaderTask.of(A a)
-
Build a ReaderTask that returns
a
.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
-
andThen<
B> (covariant ReaderTask< E, B> then()) → ReaderTask<E, B> -
Run this ReaderTask and right after the ReaderTask returned from
then
.override -
ap<
B> (covariant ReaderTask< E, B Function(A a)> a) → ReaderTask<E, B> -
Apply the function contained inside
a
to change the value of typeA
to a value of typeB
.override -
call<
B> (covariant ReaderTask< E, B> chain) → ReaderTask<E, B> -
Chain multiple ReaderTask functions.
override
-
chainFirst<
B> (covariant ReaderTask< E, B> chain(A a)) → ReaderTask<E, A> -
override
-
flatMap<
B> (covariant ReaderTask< E, B> f(A a)) → ReaderTask<E, B> -
Used to chain multiple functions that return a ReaderTask.
override
-
map<
B> (B f(A a)) → ReaderTask< E, B> -
Change the returning value of the ReaderTask from type
A
to typeB
usingf
.override -
map2<
C, D> (covariant ReaderTask< E, C> mc, D f(A a, C c)) → ReaderTask<E, D> -
Change type of this ReaderTask based on its value of type
A
and the value of typeC
of another ReaderTask.override -
map3<
C, D, F> (covariant ReaderTask< E, C> mc, covariant ReaderTask<E, D> md, F f(A a, C c, D d)) → ReaderTask<E, F> -
Change type of this ReaderTask based on its value of type
A
, the value of typeC
of a second ReaderTask, and the value of typeD
of a third ReaderTask.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
pure<
B> (B a) → ReaderTask< E, B> -
Return a ReaderTask returning the value
b
.override -
run(
E env) → Future< A> - Run the task and return a Future.
-
toReaderTaskEither<
L> () → ReaderTaskEither< E, L, A> - Convert this ReaderTask to ReaderTaskEither.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
ask<
E, A> () → ReaderTask< E, E> -
Read the current dependency
E
.