getOrElse<L, R> function
Unwrap the Either value. Resolves to the unwrapped Right value, but
if the TaskEither is an Left, the onLeft
callback determines the
fallback value.
expect(
await right('hello').chain(getOrElse(() => 'fallback'))(),
'hello',
);
expect(
await left('fail').chain(getOrElse(() => 'fallback'))(),
'fallback',
);
Implementation
Task<R> Function(TaskEither<L, R> taskEither) getOrElse<L, R>(
R Function(L left) onLeft,
) =>
task.map(either.getOrElse(onLeft));