Skip to content

chain

chain<A, B>(f): (data) => Task<B>

Defined in: Core/Task.ts:77

Chains Task computations. Passes the resolved value of the first Task to f.

A

B

(a) => Task<B>

(data): Task<B>

Task<A>

Task<B>

const readUserId: Task<string> = () => Promise.resolve(session.userId);
const loadPrefs = (id: string): Task<Preferences> => () => Promise.resolve(prefsCache.get(id));

pipe(
  readUserId,
  Task.chain(loadPrefs)
)(); // Promise<Preferences>