EffectTalk

Effect.runPromise for async Effects

Use `Effect.runPromise` to execute Effects that contain async operations. It returns a Promise, so you can `await` it or use `.then()`.

In the anti-pattern, we might use `Effect.runSync` on an async Effect and get stuck. In the Effect way, we use the right runner for the job.

  • Use `Effect.runPromise(effect)` when the Effect contains async work
  • `runPromise` returns a Promise - use .then() or await
  • Use `Effect.runSync` only for fully synchronous Effects
Loading code editor...