map<L, R, R2> function

TaskEither<L, R2> Function(TaskEither<L, R> taskEither) map<L, R, R2>(
  1. R2 f(
    1. R value
    )
)

Transform a TaskEither's value if it is Right.

expect(
  await right('hello').chain(map((s) => '$s world'))(),
  E.right('hello world'),
);
expect(
  await left('fail').chain(map((s) => '$s world'))(),
  E.left('fail'),
);

Implementation

TaskEither<L, R2> Function(TaskEither<L, R> taskEither) map<L, R, R2>(
  R2 Function(R value) f,
) =>
    (fa) => TaskEither(fa.p(task.map(either.map(f))));