recursWhileZIO<R, E, I> static method

Schedule<R, E, I, int> recursWhileZIO<R, E, I>(
  1. ZIO<R, E, bool> f(
    1. I _
    )
)

Implementation

static Schedule<R, E, I, int> recursWhileZIO<R, E, I>(
  ZIO<R, E, bool> Function(I _) f,
) =>
    Schedule._(
      (input, count, lastTick) => f(input).mapError(Option.of).flatMap(
            (repeat) => repeat ? ZIO.succeed(count) : ZIO.fail(const None()),
          ),
    );