runLogIO<O> static method

Free<IOOp, IList<O>> runLogIO<O>(
  1. Conveyor<Free<IOOp, dynamic>, O> cio
)

Implementation

static Free<IOOp, IList<O>> runLogIO<O>(Conveyor<Free<IOOp, dynamic>, O> cio) {
  Free<IOOp, IList<O>> go(Conveyor<Free<IOOp, dynamic>, O> cur, IList<O> acc) =>
    cur.interpret((h, t) => go(t, cons(h, acc)),
        (req, recv) => liftF<IOOp, Either<Object, dynamic>>(new Attempt(req)).flatMap((e) => go(Try(() => recv(e)), acc)),
        (err) => err == End ? new Pure(acc.reverse()) : liftF(new Fail(err)));
  return go(cio, nil());
}