Accumulating Errors Without Disrupting Main Flow in Effect Operations

Hello! I'm trying to grasp a nice way to accumulate errors without disrupting the main flow and while never going in the error channel.

Let's say I have N operations to do and I want to gather all successes and have at least 1 error from the M errors occurred, just to log them (ideally I'd like a set of errors without "duplicate" errors to reason about all the possible error cases happened).

Then with all the preceding successes I need to do other N operations where I want the same thing happening.

Right now my current solution is to use pipe(Effect.allWith({ mode: 'either' }), Effect.map(Array.separate)) twice. There's Effect.partition which is better.

Is there a way to both have the success values and accumulate errors in the "same" succesfull datatype (I can only think of something like These instead of Either). Like an error channel which doesn't prevent effects from running and successes from being returned.
Was this page helpful?