flatMap<R2> method

Either<L, R2> flatMap<R2>(
  1. Either<L, R2> f(
    1. R
    )
)

Flat maps the right value if this is a Right

Implementation

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