filterOrFail method
Filters the success value of this ZIO with the given predicate
, failing
with onFalse
if the predicate fails.
Implementation
ZIO<R, E, A> filterOrFail(
bool Function(A _) predicate,
E Function(A _) onFalse,
) =>
flatMap((a) => predicate(a) ? ZIO.succeed(a) : ZIO.fail(onFalse(a)));