def drain.if

bend-kit-runner@0.13.0.1 · runner.bend:1686

import bend-kit-runner@0.13.0.1/runner.bend as Runner
import Base
import bend-kit-bytes@0.3.3.0/bytes.bend as Bytes
import bend-kit-retry@0.3.0.0/retry.bend as Retry

1686def drain.if(~A: Data, ~penc: A -> Bytes.Bytes, ~target: A -> String, ~work: A -> IO(Retry.Outcome), done: Bool, r: Runner<A>, next: Runner<A> -> IO(Ran(A))) -> IO(Ran(A)):
1687  match done:
1688    case True{}:
1689      IO.pure(Ran(A), (r, Done{Unit{}}))
1690    case False{}:
1691      Runner{j, s, p, +c, ib, fs} = r
1692      Config{pol, circ, +idle, every} = c
1693      do IO<Ran(A)>:
1694        t : Runner<A> & Out(Bool) <- tick(~A, ~penc, ~target, ~work, Runner{j, s, p, c, ib, fs})
1695        drain.ticked(~A, ~penc, ~target, ~work, idle, t, next)

Uses (17)

Used by (1)