def recurse() -> Do: result = yield thunk() done = check(result) yield (TmuxIO.pure(result) if done else TmuxIO.error(error) if time.time() - start > timeout else wait_and_recurse())
def error(self, e: str) -> 'TmuxIOState[S, A]': return TmuxIOState.lift(TmuxIO.error(e))