MCPcopy Create free account
hub / github.com/Effect-TS/effect / promise

Function promise

packages/effect/src/Micro.ts:1064–1070  ·  view source on GitHub ↗
(evaluate: (signal: AbortSignal) => PromiseLike<A>)

Source from the content-addressed store, hash-verified

1062 * @category constructors
1063 */
1064export const promise = <A>(evaluate: (signal: AbortSignal) => PromiseLike<A>): Micro<A> =>
1065 asyncOptions<A>(function(resume, signal) {
1066 evaluate(signal!).then(
1067 (a) => resume(succeed(a)),
1068 (e) => resume(die(e))
1069 )
1070 }, evaluate.length !== 0)
1071
1072/**
1073 * Wrap a `Promise` into a `Micro` effect. Any errors will be caught and

Callers

nothing calls this directly

Calls 3

resumeFunction · 0.70
dieFunction · 0.70
succeedFunction · 0.50

Tested by

no test coverage detected