Finding the first successful effect in an array without returning an error
I have a function that takes an argument and returns Effect.Effect<number, MyError> and an array of values.
I want to find the first element of the array that doesn't return MyError.
At first I wanted to use Effect.forEach but I can't find a way to stop iterating when the function succeeds.
I also looked at Effect.findFirst but it works only if the function returns a boolean and returns the item when I want the calculation result.
Any suggestions?
I want to find the first element of the array that doesn't return MyError.
At first I wanted to use Effect.forEach but I can't find a way to stop iterating when the function succeeds.
I also looked at Effect.findFirst but it works only if the function returns a boolean and returns the item when I want the calculation result.
Any suggestions?
