"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.bimap_ = exports.bimap = void 0;
// ets_tracing: off
const core_1 = require("./core");
const fail_1 = require("./fail");
const foldM_1 = require("./foldM");
/**
 * Returns an effect whose failure and success channels have been mapped by
 * the specified pair of functions, `f` and `g`.
 */
function bimap(f, g, __trace) {
    return (self) => bimap_(self, f, g, __trace);
}
exports.bimap = bimap;
/**
 * Returns an effect whose failure and success channels have been mapped by
 * the specified pair of functions, `f` and `g`.
 */
function bimap_(self, f, g, __trace) {
    return (0, foldM_1.foldM_)(self, (e) => (0, fail_1.fail)(f(e)), (a) => (0, core_1.succeed)(g(a)), __trace);
}
exports.bimap_ = bimap_;
//# sourceMappingURL=bimap.js.map