map<T, R> function

Task<R> Function(Task<T> task) map<T, R>(
  1. R f(
    1. T value
    )
)

Transform the value of a Task with the provided function.

expect(
  await fromThunk(() => 'hi').chain(map((str) => str.toUpperCase()))(),
  equals('HI'),
);

Implementation

Task<R> Function(Task<T> task) map<T, R>(R Function(T value) f) =>
    (t) => Task(() => t().flatMap(f));