UNPKG

@fpjs/overture

Version:
18 lines (17 loc) 522 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isApply = exports.ap = void 0; var _base = require("@fpjs/overture/base"); var _functor = require("@fpjs/overture/algebras/functor"); const isApply = x => (0, _functor.isFunctor)(x) && "fantasy-land/ap" in x; exports.isApply = isApply; const ap = ab => a => { const op = a["fantasy-land/ap"]; if (op === undefined) { throw TypeError(`'${(0, _base.type)(a)}' is not an Apply.`); } return op.call(a, ab); }; exports.ap = ap;