filterOrElse method
If f
applied on this IOEither as Right returns true
, then return this IOEither.
If it returns false
, return the result of onFalse
in a Left.
Implementation
IOEither<L, R> filterOrElse(bool Function(R r) f, L Function(R r) onFalse) =>
flatMap((r) => f(r) ? IOEither.of(r) : IOEither.left(onFalse(r)));