"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.timeoutFailCause = exports.timeoutFailCause_ = void 0;
const core_1 = require("./core");
const flatten_1 = require("./flatten");
const timeoutTo_1 = require("./timeoutTo");
/**
 * The same as `timeout`, but instead of producing a `None` in the event
 * of timeout, it will produce the specified failure.
 */
function timeoutFailCause_(self, cause, d, __trace) {
    return (0, flatten_1.flatten)((0, timeoutTo_1.timeoutTo_)(self, d, (0, core_1.suspend)(() => (0, core_1.halt)(cause())), (_) => (0, core_1.succeed)(_), __trace));
}
exports.timeoutFailCause_ = timeoutFailCause_;
/**
 * The same as `timeout`, but instead of producing a `None` in the event
 * of timeout, it will produce the specified failure.
 *
 * @ets_data_first timeoutFailCause_
 */
function timeoutFailCause(cause, d, __trace) {
    return (self) => timeoutFailCause_(self, cause, d, __trace);
}
exports.timeoutFailCause = timeoutFailCause;
//# sourceMappingURL=timeoutFailCause.js.map