getOrElse<A> function

Task<A> Function(TaskOption<A> taskOption) getOrElse<A>(
  1. A orElse()
)

Transforms the TaskOption into a Task, by unwrapping the Some value or using the orElse value if it resolves to None.

expect(
  await some('hello').chain(getOrElse(() => 'fallback'))(),
  'hello',
);
expect(
  await none().chain(getOrElse(() => 'fallback'))(),
  'fallback',
);

Implementation

Task<A> Function(TaskOption<A> taskOption) getOrElse<A>(
  A Function() orElse,
) =>
    T.map(O.getOrElse(orElse));