mapLeft<L2> method

Either<L2, R> mapLeft<L2>(
  1. L2 f(
    1. L
    )
)

Maps the left value if this is a Left, otherwise returns this Right unchanged

Implementation

Either<L2, R> mapLeft<L2>(L2 Function(L) f) {
  return switch (this) {
    Left(:final value) => Left(f(value)),
    Right() => this as Either<L2, R>,
  };
}