flatMap<A, B> function
Transforms a value from a Task into another Task, then flattens the result.
expect(
await fromThunk(() => 'hi')
.chain(flatMap((s) => fromThunk(() => s.toUpperCase())))(),
equals('HI'),
);
Implementation
Task<B> Function(Task<A> task) flatMap<A, B>(Task<B> Function(A value) f) =>
(t) => Task(() => t().flatMap((v) => f(v)()));