@fpjs/overture
Version:
A Javascript prelude
19 lines (18 loc) • 592 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.join = exports.isChain = exports.chain = void 0;
var _base = require("@fpjs/overture/base");
var _apply = require("@fpjs/overture/algebras/apply");
const isChain = x => (0, _apply.isApply)(x) && "fantasy-land/chain" in x;
exports.isChain = isChain;
const chain = ab => m => {
const op = m["fantasy-land/chain"];
if (op === undefined) {
throw TypeError(`'${(0, _base.type)(m)}' is not an Chain.`);
}
return op.call(m, ab);
};
exports.chain = chain;
const join = exports.join = chain(_base.id);