map<R2> method

  1. @override
Either<L, R2> map<R2>(
  1. R2 f(
    1. R right
    )
)
override

Transforms the value contained in Right using the given function f, returning a new Either with the transformed value.

If this is a Left, the same instance is returned unchanged.

Implementation

@override
Either<L, R2> map<R2>(R2 Function(R right) f) {
  // Left stays unchanged during map
  return Left<L, R2>(value);
}