lefts<E, A> static method

List<E> lefts<E, A>(
  1. List<Either<E, A>> list
)

Extract all the Left values from a List<Either<E, A>>.

Implementation

static List<E> lefts<E, A>(List<Either<E, A>> list) {
  final resultList = <E>[];
  for (var i = 0; i < list.length; i++) {
    final e = list[i];
    if (e is Left<E, A>) {
      resultList.add(e._value);
    }
  }

  return resultList;
}