Overview
Task<A>
represents an asynchronous computation that yields a value of type A
and never fails.
If you want to represent an asynchronous computation that may fail, please see TaskEither
.
Table of contents
- URI (type alias)
- Task (class)
- URI (constant)
- task (constant)
- taskSeq (constant)
- delay (function)
- fromIO (function)
- getMonoid (function)
- getRaceMonoid (function)
- getSemigroup (function)
- tryCatch (function)
URI (type alias)
Signature
export type URI = typeof URI
Task (class)
Signature
export class Task<A> {
constructor(readonly run: Lazy<Promise<A>>) { ... }
...
}
Added in v1.0.0
map (method)
Signature
map<B>(f: (a: A) => B): Task<B> { ... }
ap (method)
Signature
ap<B>(fab: Task<(a: A) => B>): Task<B> { ... }
ap_ (method)
Flipped version of ap
Signature
ap_<B, C>(this: Task<(b: B) => C>, fb: Task<B>): Task<C> { ... }
applyFirst (method)
Combine two effectful actions, keeping only the result of the first
Signature
applyFirst<B>(fb: Task<B>): Task<A> { ... }
Added in v1.6.0
applySecond (method)
Combine two effectful actions, keeping only the result of the second
Signature
applySecond<B>(fb: Task<B>): Task<B> { ... }
Added in v1.5.0
chain (method)
Signature
chain<B>(f: (a: A) => Task<B>): Task<B> { ... }
inspect (method)
Signature
inspect(): string { ... }
toString (method)
Signature
toString(): string { ... }
URI (constant)
Signature
export const URI = ...
task (constant)
Signature
export const task: Monad1<URI> & MonadIO1<URI> & MonadTask1<URI> = ...
Added in v1.0.0
taskSeq (constant)
Like Task
but ap
is sequential
Signature
export const taskSeq: typeof task = ...
Added in v1.10.0
delay (function)
Signature
export const delay = <A>(millis: number, a: A): Task<A> => ...
Added in v1.7.0
fromIO (function)
Lifts an IO action into a Task
Signature
export const fromIO = <A>(io: IO<A>): Task<A> => ...
Added in v1.0.0
getMonoid (function)
Signature
export const getMonoid = <A>(M: Monoid<A>): Monoid<Task<A>> => ...
Added in v1.0.0
getRaceMonoid (function)
Signature
export const getRaceMonoid = <A = never>(): Monoid<Task<A>> => ...
Added in v1.0.0
getSemigroup (function)
Signature
export const getSemigroup = <A>(S: Semigroup<A>): Semigroup<Task<A>> => ...
Added in v1.0.0
tryCatch (function)
Signature
export const tryCatch = <L, A>(f: Lazy<Promise<A>>, onrejected: (reason: unknown) => L): Task<Either<L, A>> => ...
Added in v1.0.0