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