fp-ts-std
Version:
The missing pseudo-standard library for fp-ts.
16 lines (15 loc) • 611 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.over = exports.overF = exports.unpack = exports.pack = void 0;
const Id = require("fp-ts/Identity");
const function_1 = require("fp-ts/function");
const newtype_ts_1 = require("newtype-ts");
const pack = (x) => (0, newtype_ts_1.iso)().wrap(x);
exports.pack = pack;
const unpack = (x) => (0, newtype_ts_1.iso)().unwrap(x);
exports.unpack = unpack;
function overF(F) {
return (f) => (x) => (0, function_1.pipe)(x, exports.unpack, f, y => F.map(y, (exports.pack)));
}
exports.overF = overF;
exports.over = overF(Id.Functor);
;