"use strict"
// tracing: off
Object.defineProperty(exports, "__esModule", { value: true })
exports.whenM = exports.whenM_ = void 0
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 core_1.chain_(predicate, (a) =>
    a ? asUnit_1.asUnit(self, __trace) : core_1.unit
  )
}
exports.whenM_ = whenM_
/**
 * The moral equivalent of `if (p) exp` when `p` has side-effects
 *
 * @dataFirst whenM_
 */
function whenM(predicate, __trace) {
  return (self) => whenM_(self, predicate, __trace)
}
exports.whenM = whenM
//# sourceMappingURL=whenM.js.map
