// tracing: off
import { identity } from "../Function"
import { fold } from "../Option"
import { mapError_ } from "./mapError"
/**
 * Unwraps the optional error, defaulting to the provided value.
 *
 * @dataFirst flattenErrorOption_
 */

export function flattenErrorOption(def, __trace) {
  return (self) => flattenErrorOption_(self, def, __trace)
}
/**
 * Unwraps the optional error, defaulting to the provided value.
 */

export function flattenErrorOption_(self, def, __trace) {
  return mapError_(self, fold(def, identity), __trace)
}
//# sourceMappingURL=flattenErrorOption.js.map
