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