Skip to content

fromSync

fromSync<A>(f): Task<A>

Defined in: Core/Task.ts:89

Creates a Task from a lazy synchronous thunk. Unlike Task.resolve(f()), fromSync does not evaluate f until the Task is called.

A

() => A

Task<A>

const t = Task.fromSync(() => Date.now()); // Date.now() not called yet
const ts = await t(); // called here, every time