map<L, R, NR> function

Either<L, NR> Function(Either<L, R> either) map<L, R, NR>(
  1. NR f(
    1. R value
    )
)

Transforms the wrapped value if the Either is a Right.

expect(
  right(1).chain(map((i) => i * 2)),
  equals(right(2)),
);

Implementation

Either<L, NR> Function(Either<L, R> either) map<L, R, NR>(
  NR Function(R value) f,
) =>
    fold(left, f.compose(right));