// tracing: off
import * as O from "../Option"
import { chain_, succeed, succeedWith } from "./core"
import { fail } from "./fail"
/**
 * Requires that the given `Effect<R, E, Option<A>>` contain a value. If there is no
 * value, then the specified error will be raised.
 *
 * @dataFirst require_
 */

function _require(error, __trace) {
  return (io) => require_(io, error, __trace)
}
/**
 * Requires that the given `Effect<R, E, Option<A>>` contain a value. If there is no
 * value, then the specified error will be raised.
 */

export function require_(io, error, __trace) {
  return chain_(
    io,
    O.fold(() => chain_(succeedWith(error), fail), succeed),
    __trace
  )
}
export { _require as require }
//# sourceMappingURL=require.js.map
