toEither<L> method

Either<L, T> toEither<L>(
  1. L onLeft()
)

Build an Either from Option.

Return Right when Option is Some, otherwise Left containing the result of calling onLeft.

Implementation

Either<L, T> toEither<L>(L Function() onLeft) => match(
      () => Left(onLeft()),
      Right.new,
    );