"use strict"
Object.defineProperty(exports, "__esModule", { value: true })
exports.repeatUntil_ =
  exports.repeatUntil =
  exports.repeatUntilM_ =
  exports.repeatUntilM =
    void 0
// tracing: off
const core_1 = require("./core")
/**
 * Repeats this effect until its error satisfies the specified effectful predicate.
 *
 * @dataFirst repeatUntilM_
 */
function repeatUntilM(f, __trace) {
  return (self) => repeatUntilM_(self, f)
}
exports.repeatUntilM = repeatUntilM
/**
 * Repeats this effect until its error satisfies the specified effectful predicate.
 */
function repeatUntilM_(self, f, __trace) {
  return (0, core_1.chain_)(
    self,
    (a) =>
      (0, core_1.chain_)(f(a), (b) =>
        b ? (0, core_1.succeed)(a) : repeatUntilM_(self, f)
      ),
    __trace
  )
}
exports.repeatUntilM_ = repeatUntilM_
/**
 * Repeats this effect until its error satisfies the specified predicate.
 *
 * @dataFirst repeatUntil_
 */
function repeatUntil(f, __trace) {
  return (self) => repeatUntil_(self, f, __trace)
}
exports.repeatUntil = repeatUntil
/**
 * Repeats this effect until its error satisfies the specified predicate.
 */
function repeatUntil_(self, f, __trace) {
  return repeatUntilM_(self, (a) => (0, core_1.succeed)(f(a)), __trace)
}
exports.repeatUntil_ = repeatUntil_
//# sourceMappingURL=repeatUntil.js.map
