// ets_tracing: off
import { squash } from "../Cause";
import { identity, pipe } from "../Function";
import { succeed } from "./core";
import { fail } from "./fail";
import { foldM_ } from "./foldM";
import { sandbox } from "./sandbox";
/**
 * Attempts to convert defects into a failure, throwing away all information
 * about the cause of the failure.
 */

export function absorbWith(f, __trace) {
  return fa => absorbWith_(fa, f, __trace);
}
/**
 * Attempts to convert defects into a failure, throwing away all information
 * about the cause of the failure.
 */

export function absorbWith_(fa, f, __trace) {
  return foldM_(sandbox(fa), x => fail(squash(f)(x)), succeed, __trace);
}
/**
 * Attempts to convert defects into a failure, throwing away all information
 * about the cause of the failure.
 */

export function absorb(self, __trace) {
  return absorbWith_(self, identity, __trace);
}
//# sourceMappingURL=absorbWith.js.map