// tracing: off
import * as O from "../Option"
import { chain_, succeed, succeedWith } from "./core"
import { fail } from "./fail"
/**
 * Extracts the optional value, or fails with the given error 'e'.
 *
 * @dataFirst someOrFail_
 */

export function someOrFail(orFail, __trace) {
  return (self) => someOrFail_(self, orFail)
}
/**
 * Extracts the optional value, or fails with the given error 'e'.
 */

export function someOrFail_(self, orFail, __trace) {
  return chain_(
    self,
    O.fold(() => chain_(succeedWith(orFail), fail), succeed),
    __trace
  )
}
//# sourceMappingURL=someOrFail.js.map
