UNPKG

@typed/fp

Version:

Data Structures and Resources for fp-ts

29 lines 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.condemn = exports.absolve = void 0; const tslib_1 = require("tslib"); /** * These is an extension of fp-ts/These * @since 0.12.1 */ const EI = (0, tslib_1.__importStar)(require("fp-ts/Either")); const function_1 = require("fp-ts/function"); const TH = (0, tslib_1.__importStar)(require("fp-ts/These")); /** * Convert These<E, A> into an Either<E, A>. If the These is a Both<E, A> * a Right<A> will be returned * @category Combinator * @since 0.12.1 */ const absolve = (these) => (0, function_1.pipe)(these, TH.matchW(EI.left, EI.right, (_, x) => EI.right(x))); exports.absolve = absolve; /** * Convert These<E, A> into an Either<E, A>. If the These<E, A> is a Both<E, A> * a Lef<E> will be returned * @category Combinator * @since 0.12.1 */ const condemn = (these) => (0, function_1.pipe)(these, TH.matchW(EI.left, EI.right, EI.left)); exports.condemn = condemn; (0, tslib_1.__exportStar)(require("fp-ts/These"), exports); //# sourceMappingURL=These.js.map