Handling Nested Loops in Effectful Programs

I've got a function that runs a few nested loops that I'm attempting to turn into an Effectful program (in thread). Pretty sure I'm doing it wrong 🙂

I'd like to know:

1. Is this how you would structure this code?
2. Why doesn't my
Effect.fail
short-circuit the program?
3. How do I unwrap the nested Effect.Effect<...> type that is the result of the final Effect.loop? (seen below)

// Effect.Effect<(Effect.Effect<never, TestError, never> | Effect.Effect<{ result: number; }, never, never>)[][][], never, never>
const program = runs(options);
Was this page helpful?