"use strict"
Object.defineProperty(exports, "__esModule", { value: true })
exports.whenCase = exports.whenCase_ = void 0
const asUnit_1 = require("./asUnit")
const core_1 = require("./core")
/**
 * Runs an effect when the supplied `PartialFunction` matches for the given value, otherwise does nothing.
 */
function whenCase_(a, pf, __trace) {
  return (0, core_1.suspend)(() => {
    const p = pf(a)
    if (p._tag === "None") {
      return core_1.unit
    }
    return (0, asUnit_1.asUnit)(p.value)
  }, __trace)
}
exports.whenCase_ = whenCase_
/**
 * Runs an effect when the supplied `PartialFunction` matches for the given value, otherwise does nothing.
 *
 * @dateFirst whenCase_
 */
function whenCase(pf, __trace) {
  return (a) => whenCase_(a, pf, __trace)
}
exports.whenCase = whenCase
//# sourceMappingURL=whenCase.js.map
