"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.repeatWhile_ = exports.repeatWhile = exports.repeatWhileM_ = exports.repeatWhileM = void 0;
// ets_tracing: off
const core_1 = require("./core");
/**
 * Repeats this effect while its error satisfies the specified effectful predicate.
 *
 * @ets_data_first repeatWhileM_
 */
function repeatWhileM(f, __trace) {
    return (self) => repeatWhileM_(self, f, __trace);
}
exports.repeatWhileM = repeatWhileM;
/**
 * Repeats this effect while its error satisfies the specified effectful predicate.
 */
function repeatWhileM_(self, f, __trace) {
    return (0, core_1.chain_)(self, (a) => (0, core_1.chain_)(f(a), (b) => (b ? repeatWhileM_(self, f) : (0, core_1.succeed)(a))), __trace);
}
exports.repeatWhileM_ = repeatWhileM_;
/**
 * Repeats this effect while its error satisfies the specified predicate.
 *
 * @ets_data_first repeatWhile_
 */
function repeatWhile(f, __trace) {
    return (self) => repeatWhile_(self, f, __trace);
}
exports.repeatWhile = repeatWhile;
/**
 * Repeats this effect while its error satisfies the specified predicate.
 */
function repeatWhile_(self, f, __trace) {
    return repeatWhileM_(self, (a) => (0, core_1.succeed)(f(a)), __trace);
}
exports.repeatWhile_ = repeatWhile_;
//# sourceMappingURL=repeatWhile.js.map