flatMapFirst<A> function
Similar to flatMap, except Some values are discarded.
expect( await some(123).chain(flatMapFirst((i) => some('got: $i')))(), O.some(123), ); expect( await some(123).chain(flatMapFirst((i) => none()))(), O.none(), );
Implementation
TaskOption<A> Function(TaskOption<A> taskOption) flatMapFirst<A>(
TaskOption<dynamic> Function(A value) f,
) =>
flatMap((r) => f(r).chain(map((_) => r)));