IOEither<L, R>.fromPredicate constructor
IOEither<L, R>.fromPredicate (
- R value,
- bool predicate(
- R a
- L onFalse(
- R a
When calling predicate
with value
returns true
, then running IOEither returns Right(value)
.
Otherwise return onFalse
.
Implementation
factory IOEither.fromPredicate(
R value, bool Function(R a) predicate, L Function(R a) onFalse) =>
IOEither(() => predicate(value) ? Right(value) : Left(onFalse(value)));