"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.flattenErrorOption_ = exports.flattenErrorOption = void 0;
// ets_tracing: off
const Function_1 = require("../Function");
const Option_1 = require("../Option");
const mapError_1 = require("./mapError");
/**
 * Unwraps the optional error, defaulting to the provided value.
 *
 * @ets_data_first flattenErrorOption_
 */
function flattenErrorOption(def, __trace) {
    return (self) => flattenErrorOption_(self, def, __trace);
}
exports.flattenErrorOption = flattenErrorOption;
/**
 * Unwraps the optional error, defaulting to the provided value.
 */
function flattenErrorOption_(self, def, __trace) {
    return (0, mapError_1.mapError_)(self, (0, Option_1.fold)(def, Function_1.identity), __trace);
}
exports.flattenErrorOption_ = flattenErrorOption_;
//# sourceMappingURL=flattenErrorOption.js.map