alt<A> function

TaskOption<A> Function(TaskOption<A> taskOption) alt<A>(
  1. TaskOption<A> onNone()
)

If the TaskOption resolves to None, then the alternative TaskOption will be used.

The inverse of flatMap.

expect(
  await none().chain(alt(() => some('hello')))(),
  O.some('hello'),
);

Implementation

TaskOption<A> Function(TaskOption<A> taskOption) alt<A>(
  TaskOption<A> Function() onNone,
) =>
    (fa) => TaskOption(fa.p(T.flatMap(O.fold(onNone, some))));