"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.unlessM_ = exports.unlessM = exports.unless_ = exports.unless = void 0;
// ets_tracing: off
const asUnit_1 = require("./asUnit");
const core_1 = require("./core");
/**
 * The moral equivalent of `if (!p) exp`
 *
 * @ets_data_first unless_
 */
function unless(b, __trace) {
    return (self) => (0, core_1.suspend)(() => (b() ? core_1.unit : (0, asUnit_1.asUnit)(self)), __trace);
}
exports.unless = unless;
/**
 * The moral equivalent of `if (!p) exp`
 */
function unless_(self, b, __trace) {
    return (0, core_1.suspend)(() => (b() ? core_1.unit : (0, asUnit_1.asUnit)(self)), __trace);
}
exports.unless_ = unless_;
/**
 * The moral equivalent of `if (!p) exp` when `p` has side-effects
 *
 * @ets_data_first unlessM_
 */
function unlessM(b, __trace) {
    return (self) => unlessM_(self, b, __trace);
}
exports.unlessM = unlessM;
/**
 * The moral equivalent of `if (!p) exp` when `p` has side-effects
 */
function unlessM_(self, b, __trace) {
    return (0, core_1.chain_)(b, (_) => (_ ? core_1.unit : (0, asUnit_1.asUnit)(self)), __trace);
}
exports.unlessM_ = unlessM_;
//# sourceMappingURL=unless.js.map