consume<I, O> static method

Conveyor<From<I>, O> consume<I, O>(
  1. Function1<I, Conveyor<From<I>, O>> recv, [
  2. Function0<Conveyor<From<I>, O>>? fallback
])

Implementation

static Conveyor<From<I>, O> consume<I, O>(Function1<I, Conveyor<From<I>, O>> recv, [Function0<Conveyor<From<I>, O>>? fallback]) =>
    Conveyor.consume(new From(), (Either<Object, I> ea) => ea.fold(
        (err) => err == Conveyor.End ? (fallback == null ? halt() : fallback()) : Conveyor.halt(err)
        ,(I i) => Conveyor.Try(() => recv(i))));