"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.uncause = void 0;
const cause_1 = require("../Cause/cause");
const core_1 = require("./core");
/**
 * When this effect succeeds with a cause, then this method returns a new
 * effect that either fails with the cause that this effect succeeded with,
 * or succeeds with unit, depending on whether the cause is empty.
 *
 * This operation is the opposite of `cause`.
 */
function uncause(effect, __trace) {
    return (0, core_1.chain_)(effect, (a) => ((0, cause_1.isEmpty)(a) ? core_1.unit : (0, core_1.halt)(a)), __trace);
}
exports.uncause = uncause;
//# sourceMappingURL=uncause.js.map