import { bracketExit_ } from "./bracketExit"
import { unit } from "./core"
/**
 * Executes the release effect only if there was an error.
 *
 * @dataFirst bracketOnError_
 */

export function bracketOnError(use, release, __trace) {
  return (acquire) => bracketOnError_(acquire, use, release, __trace)
}
/**
 * Executes the release effect only if there was an error.
 */

export function bracketOnError_(acquire, use, release, __trace) {
  return bracketExit_(
    acquire,
    use,
    (a, e) => (e._tag === "Success" ? unit : release(a, e)),
    __trace
  )
}
//# sourceMappingURL=bracketOnError.js.map
