"use strict"
Object.defineProperty(exports, "__esModule", { value: true })
exports.timeoutFail_ = exports.timeoutFail = void 0
const core_1 = require("./core")
const fail_1 = require("./fail")
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 error.
 *
 * @dataFirst timeoutFail_
 */
function timeoutFail(d, e, __trace) {
  return (self) => timeoutFail_(self, d, e, __trace)
}
exports.timeoutFail = timeoutFail
/**
 * The same as `timeout`, but instead of producing a `None` in the event
 * of timeout, it will produce the specified error.
 */
function timeoutFail_(self, d, e, __trace) {
  return (0, flatten_1.flatten)(
    (0, timeoutTo_1.timeoutTo_)(
      self,
      d,
      (0, core_1.suspend)(() => (0, fail_1.fail)(e())),
      core_1.succeed,
      __trace
    )
  )
}
exports.timeoutFail_ = timeoutFail_
//# sourceMappingURL=timeoutFail.js.map
