mapLeft<L1, L2, R> function

Either<L2, R> Function(Either<L1, R> either) mapLeft<L1, L2, R>(
  1. L2 f(
    1. L1 value
    )
)

Transforms the wrapped value if the Either is a Left.

expect(
  left('fail').chain(mapLeft((s) => '${s}ure')),
  equals(left('failure')),
);

Implementation

Either<L2, R> Function(Either<L1, R> either) mapLeft<L1, L2, R>(
  L2 Function(L1 value) f,
) =>
    fold(f.compose(left), right);