@matechs/effect
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -33,23 +33,23 @@ "use strict"; | ||
URI: exports.URI, | ||
of: function (a) { return function (_) { return F.of(a); }; }, | ||
map: function (fa, f) { return function (r) { return F.map(f, fa(r)); }; }, | ||
ap: function (fab, fa) { return function (r) { return F.ap(fab(r), fa(r)); }; }, | ||
of: function (a) { return function (_) { return F.resolve(a); }; }, | ||
map: function (fa, f) { return function (r) { return F.map(f)(fa(r)); }; }, | ||
ap: function (fab, fa) { return function (r) { return F.ap(fa(r))(fab(r)); }; }, | ||
chain: function (fa, f) { return function (r) { | ||
return F.chain(function (x) { return f(x)(r); }, fa(r)); | ||
return F.chain(function (x) { return f(x)(r); })(fa(r)); | ||
}; }, | ||
throwError: function (e) { return function (_) { return F.reject(e); }; }, | ||
bimap: function (fea, f, g) { return function (r) { return F.bimap(f, g, fea(r)); }; }, | ||
mapLeft: function (fea, f) { return function (r) { return F.mapRej(f, fea(r)); }; } | ||
bimap: function (fea, f, g) { return function (r) { return F.bimap(f)(g)(fea(r)); }; }, | ||
mapLeft: function (fea, f) { return function (r) { return F.mapRej(f)(fea(r)); }; } | ||
}; | ||
exports.concurrentEffectMonad = { | ||
URI: exports.URIC, | ||
of: function (a) { return function (_) { return fluture_1.Par(F.of(a)); }; }, | ||
map: function (fa, f) { return function (r) { return F.map(f, fa(r)); }; }, | ||
ap: function (fab, fa) { return function (r) { return F.ap(fab(r), fa(r)); }; }, | ||
of: function (a) { return function (_) { return fluture_1.Par(F.resolve(a)); }; }, | ||
map: function (fa, f) { return function (r) { return fluture_1.Par(F.map(f)(fa(r).sequential)); }; }, | ||
ap: function (fab, fa) { return function (r) { return F.ap(fa(r))(fab(r)); }; }, | ||
chain: function (fa, f) { return function (r) { | ||
return fluture_1.Par(F.chain(function (x) { return f(x)(r).sequential; }, fa(r).sequential)); | ||
return fluture_1.Par(F.chain(function (x) { return f(x)(r).sequential; })(fa(r).sequential)); | ||
}; }, | ||
throwError: function (e) { return function (_) { return fluture_1.Par(F.reject(e)); }; }, | ||
bimap: function (fea, f, g) { return function (r) { return fluture_1.Par(F.bimap(f, g, fea(r).sequential)); }; }, | ||
mapLeft: function (fea, f) { return function (r) { return fluture_1.Par(F.mapRej(f, fea(r).sequential)); }; } | ||
bimap: function (fea, f, g) { return function (r) { return fluture_1.Par(F.bimap(f)(g)(fea(r).sequential)); }; }, | ||
mapLeft: function (fea, f) { return function (r) { return fluture_1.Par(F.mapRej(f)(fea(r).sequential)); }; } | ||
}; | ||
@@ -76,3 +76,3 @@ exports.ap = (_a = __assign(__assign({}, pipeable_1.pipeable(exports.effectMonad)), { pipeablePar: pipeable_1.pipeable(exports.concurrentEffectMonad) }), _a.ap), exports.apFirst = _a.apFirst, exports.apSecond = _a.apSecond, exports.chain = _a.chain, exports.chainFirst = _a.chainFirst, exports.flatten = _a.flatten, exports.map = _a.map, exports.bimap = _a.bimap, exports.filterOrElse = _a.filterOrElse, exports.fromEither = _a.fromEither, exports.fromOption = _a.fromOption, exports.fromPredicate = _a.fromPredicate, exports.mapLeft = _a.mapLeft, exports.pipeablePar = _a.pipeablePar; | ||
function liftPromise(f) { | ||
return function (_) { return F.tryP(f); }; | ||
return function (_) { return F.attemptP(f); }; | ||
} | ||
@@ -85,11 +85,13 @@ exports.liftPromise = liftPromise; | ||
function tryCatch(f, onLeft) { | ||
return function (_) { return F.tryP(f).mapRej(onLeft); }; | ||
return function (_) { return F.mapRej(onLeft)(F.attemptP(f)); }; | ||
} | ||
exports.tryCatch = tryCatch; | ||
function tryCatchIO(f, onLeft) { | ||
return function (_) { return F.encase(f)({}).mapRej(onLeft); }; | ||
return function (_) { return F.mapRej(onLeft)(F.encase(f)({})); }; | ||
} | ||
exports.tryCatchIO = tryCatchIO; | ||
function chainLeft(ma, onLeft) { | ||
return function (r) { return ma(r).chainRej(function (e) { return onLeft(e)(r); }); }; | ||
return function (r) { | ||
return pipeable_1.pipe(ma(r), F.chainRej(function (e) { return onLeft(e)(r); })); | ||
}; | ||
} | ||
@@ -127,3 +129,3 @@ exports.chainLeft = chainLeft; | ||
function access(f) { | ||
return function (r) { return F.of(f(r)); }; | ||
return function (r) { return F.resolve(f(r)); }; | ||
} | ||
@@ -142,5 +144,3 @@ exports.access = access; | ||
function sequenceP(n, ops) { | ||
return function (r) { | ||
return F.parallel(n, ops.map(function (op) { return op(r); })); | ||
}; | ||
return function (r) { return F.parallel(n)(ops.map(function (op) { return op(r); })); }; | ||
} | ||
@@ -150,16 +150,11 @@ exports.sequenceP = sequenceP; | ||
function run(ma) { | ||
return function () { | ||
return ma(exports.noEnv) | ||
.map(function (r) { return Ei.right(r); }) | ||
.chainRej(function (e) { return F.of(Ei.left(e)); }) | ||
.promise(); | ||
}; | ||
return function () { return F.promise(toTaskLike(ma)(exports.noEnv)); }; | ||
} | ||
exports.run = run; | ||
function promise(ma) { | ||
return ma(exports.noEnv).promise(); | ||
return F.promise(ma(exports.noEnv)); | ||
} | ||
exports.promise = promise; | ||
function fork(res, rej) { | ||
return function (ma) { return F.fork(rej, res)(ma(exports.noEnv)); }; | ||
return function (ma) { return F.fork(rej)(res)(ma(exports.noEnv)); }; | ||
} | ||
@@ -181,5 +176,3 @@ exports.fork = fork; | ||
return function (r) { | ||
return ma(r) | ||
.map(function (a) { return Ei.right(a); }) | ||
.chainRej(function (e) { return F.of(Ei.left(e)); }); | ||
return pipeable_1.pipe(ma(r), F.map(function (a) { return Ei.right(a); }), F.chainRej(function (e) { return F.resolve(Ei.left(e)); })); | ||
}; | ||
@@ -186,0 +179,0 @@ } |
{ | ||
"name": "@matechs/effect", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"license": "MIT", | ||
@@ -33,7 +33,7 @@ "private": false, | ||
"deepmerge": "^4.2.2", | ||
"fluture": "^11.0.3", | ||
"fluture": "^12.0.0", | ||
"fp-ts": "^2.1.2", | ||
"fp-ts-contrib": "^0.1.6" | ||
}, | ||
"gitHead": "ea53f9562bbbb754ac26fadc32973d7376351789" | ||
"gitHead": "4b80f685b48438b3bc765d99b342b395f9c50367" | ||
} |
Sorry, the diff of this file is not supported yet
34413
325
+ Addedfluture@12.3.1(transitive)
+ Addedsanctuary-show@2.0.0(transitive)
+ Addedsanctuary-type-identifiers@3.0.0(transitive)
- Removedconcurrify@1.1.1(transitive)
- Removedfluture@11.0.3(transitive)
- Removedsanctuary-show@1.0.0(transitive)
- Removedsanctuary-type-identifiers@2.0.1(transitive)
Updatedfluture@^12.0.0