Short-circuit behavior of forked effects in Effect Typescript

Short-circuit behavior on forked Effects


When you fork an effect, the failure won't short-circuit until you join it back in, right? Consider the following:

const instructions = Effect.gen(function* () { 
   const some_delayed_outcome_fiber = yield* Effect.fork(
      Effect.tryPromise(() => somePromiseFunction())
   );
   
  //Other logic, effects, etc. all through here
  //However if at any point the above fiber hits a failure, want to return early

  //my current understanding is the failure and short circuit won't happen till here
   const outcome = yield* Fiber.join(some_delayed_outcome_fiber);
});


If that's true, is there an idiomatic way to get all the same behavior otherwise as above, but have that forked failure immediately short-circuit that parent fiber?

If that's not true and it does in fact already short-circuit eagerly in the parent fiber, then great!
Was this page helpful?