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


Task (interface)

Signature

export interface Task<A> {
  (): Promise<A>
}

Added in v2.0.0

URI (type alias)

Signature

export type URI = typeof URI

Added in v2.0.0

URI (constant)

Signature

export const URI: "Task" = ...

Added in v2.0.0

task (constant)

Signature

export const task: Monad1<URI> & MonadTask1<URI> = ...

Added in v2.0.0

taskSeq (constant)

Like Task but ap is sequential

Signature

export const taskSeq: typeof task = ...

Added in v2.0.0

delay (function)

Signature

export function delay(millis: number): <A>(ma: Task<A>) => Task<A> { ... }

Added in v2.0.0

fromIO (function)

Signature

export function fromIO<A>(ma: IO<A>): Task<A> { ... }

Added in v2.0.0

getMonoid (function)

Signature

export function getMonoid<A>(M: Monoid<A>): Monoid<Task<A>> { ... }

Added in v2.0.0

getRaceMonoid (function)

Signature

export function getRaceMonoid<A = never>(): Monoid<Task<A>> { ... }

Added in v2.0.0

getSemigroup (function)

Signature

export function getSemigroup<A>(S: Semigroup<A>): Semigroup<Task<A>> { ... }

Added in v2.0.0

never (function)

Signature

export const never: Task<never> = () => new Promise(_ => ...

Added in v2.0.0

of (function)

Signature

export function of<A>(a: A): Task<A> { ... }

Added in v2.0.0

ap (export)

Signature

<A>(fa: Task<A>) => <B>(fab: Task<(a: A) => B>) => Task<B>

Added in v2.0.0

apFirst (export)

Signature

<B>(fb: Task<B>) => <A>(fa: Task<A>) => Task<A>

Added in v2.0.0

apSecond (export)

Signature

<B>(fb: Task<B>) => <A>(fa: Task<A>) => Task<B>

Added in v2.0.0

chain (export)

Signature

<A, B>(f: (a: A) => Task<B>) => (ma: Task<A>) => Task<B>

Added in v2.0.0

chainFirst (export)

Signature

<A, B>(f: (a: A) => Task<B>) => (ma: Task<A>) => Task<A>

Added in v2.0.0

flatten (export)

Signature

<A>(mma: Task<Task<A>>) => Task<A>

Added in v2.0.0

map (export)

Signature

<A, B>(f: (a: A) => B) => (fa: Task<A>) => Task<B>

Added in v2.0.0