EffectTalk

Effect.fork for background work

Use Effect.fork to run an Effect in the background. It returns a Fiber that you can join to get the result, or interrupt to cancel.

In the anti-pattern, we block on everything. In the Effect way, we fork and continue.

  • Use Effect.fork(effect) to run in background
  • Returns a Fiber - use fiber.join to wait for result
  • Use Fiber.interrupt to cancel
Loading code editor...