Socket
Socket
Sign inDemoInstall

fluture

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fluture - npm Package Compare versions

Comparing version 4.3.1 to 4.3.2

434

es5.js

@@ -5,4 +5,2 @@ 'use strict';

function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
//// ____ _ _

@@ -32,4 +30,2 @@ //// / ___| | | |_

var _CachedFuture$STATE;
function deprecate(message) {

@@ -54,2 +50,3 @@ (console.warn || console.log || noop).call(console, message); //eslint-disable-line

function isForkable(m) {
deprecate('Future.isForkable() is deprecated');
return Boolean(m) && typeof m.fork === 'function' && m.fork.length >= 2;

@@ -145,41 +142,4 @@ }

//Creates a dispatcher for a nullary method.
function createNullaryDispatcher(method) {
return function nullaryDispatch(m) {
if (m && typeof m[method] === 'function') return m[method]();
return error$invalidArgument('Future.' + method, 1, 'have a "' + method + '" method', m);
};
}
//Creates a dispatcher for a unary method.
function createUnaryDispatcher(method) {
return function unaryDispatch(a, m) {
if (arguments.length === 1) return unaryPartial(unaryDispatch, a);
if (m && typeof m[method] === 'function') return m[method](a);
return error$invalidArgument('Future.' + method, 1, 'have a "' + method + '" method', m);
};
}
//Creates a dispatcher for a binary method.
function createBinaryDispatcher(method) {
return function binaryDispatch(a, b, m) {
if (arguments.length === 1) return unaryPartial(binaryDispatch, a);
if (arguments.length === 2) return binaryPartial(binaryDispatch, a, b);
if (m && typeof m[method] === 'function') return m[method](a, b);
return error$invalidArgument('Future.' + method, 2, 'have a "' + method + '" method', m);
};
}
//Creates a dispatcher for a binary method, but takes the object first rather than last.
function createInvertedBinaryDispatcher(method) {
return function invertedBinaryDispatch(m, a, b) {
if (arguments.length === 1) return unaryPartial(invertedBinaryDispatch, m);
if (arguments.length === 2) return binaryPartial(invertedBinaryDispatch, m, a);
if (m && typeof m[method] === 'function') return m[method](a, b);
return error$invalidArgument('Future.' + method, 0, 'have a "' + method + '" method', m);
};
}
//Creates an error about an invalid argument.
function error$invalidArgument(it, at, expected, actual) {
function invalidArgument(it, at, expected, actual) {
throw new TypeError(it + ' expects its ' + ordinal[at] + ' argument to ' + expected + '\n Actual: ' + show(actual));

@@ -189,3 +149,3 @@ }

//Creates an error message about a method being called with an invalid context.
function error$invalidContext(it, actual) {
function invalidContext(it, actual) {
throw new TypeError(it + ' was invoked outside the context of a Future. You might want to use' + (' a dispatcher instead\n Called on: ' + show(actual)));

@@ -199,3 +159,3 @@ }

function Future(f) {
if (!isFunction(f)) error$invalidArgument('Future', 0, 'be a function', f);
if (!isFunction(f)) invalidArgument('Future', 0, 'be a function', f);
return new SafeFuture(f);

@@ -210,3 +170,3 @@ }

if (arguments.length === 1) return unaryPartial(Future$chainRec, f);
if (!isFunction(f)) error$invalidArgument('Future.chainRec', 0, 'be a function', f);
if (!isFunction(f)) invalidArgument('Future.chainRec', 0, 'be a function', f);
return new ChainRec(f, init);

@@ -226,4 +186,4 @@ }

Future.prototype.ap = function Future$ap(m) {
if (!isFuture(this)) error$invalidContext('Future#ap', this);
if (!isFuture(m)) error$invalidArgument('Future#ap', 0, 'be a Future', m);
if (!isFuture(this)) invalidContext('Future#ap', this);
if (!isFuture(m)) invalidArgument('Future#ap', 0, 'be a Future', m);
return new FutureAp(this, m);

@@ -233,4 +193,4 @@ };

Future.prototype.map = function Future$map(f) {
if (!isFuture(this)) error$invalidContext('Future#map', this);
if (!isFunction(f)) error$invalidArgument('Future#map', 0, 'be a function', f);
if (!isFuture(this)) invalidContext('Future#map', this);
if (!isFunction(f)) invalidArgument('Future#map', 0, 'be a function', f);
return new FutureMap(this, f);

@@ -240,5 +200,5 @@ };

Future.prototype.bimap = function Future$bimap(f, g) {
if (!isFuture(this)) error$invalidContext('Future#bimap', this);
if (!isFunction(f)) error$invalidArgument('Future#bimap', 0, 'be a function', f);
if (!isFunction(g)) error$invalidArgument('Future#bimap', 1, 'be a function', g);
if (!isFuture(this)) invalidContext('Future#bimap', this);
if (!isFunction(f)) invalidArgument('Future#bimap', 0, 'be a function', f);
if (!isFunction(g)) invalidArgument('Future#bimap', 1, 'be a function', g);
return new FutureBimap(this, f, g);

@@ -248,4 +208,4 @@ };

Future.prototype.chain = function Future$chain(f) {
if (!isFuture(this)) error$invalidContext('Future#chain', this);
if (!isFunction(f)) error$invalidArgument('Future#chain', 0, 'be a function', f);
if (!isFuture(this)) invalidContext('Future#chain', this);
if (!isFunction(f)) invalidArgument('Future#chain', 0, 'be a function', f);
return new FutureChain(this, f);

@@ -255,4 +215,4 @@ };

Future.prototype.chainRej = function Future$chainRej(f) {
if (!isFuture(this)) error$invalidContext('Future.chainRej', this);
if (!isFunction(f)) error$invalidArgument('Future.chainRej', 0, 'a function', f);
if (!isFuture(this)) invalidContext('Future.chainRej', this);
if (!isFunction(f)) invalidArgument('Future.chainRej', 0, 'a function', f);
return new FutureChainRej(this, f);

@@ -262,4 +222,4 @@ };

Future.prototype.mapRej = function Future$mapRej(f) {
if (!isFuture(this)) error$invalidContext('Future#mapRej', this);
if (!isFunction(f)) error$invalidArgument('Future#mapRej', 0, 'be a function', f);
if (!isFuture(this)) invalidContext('Future#mapRej', this);
if (!isFunction(f)) invalidArgument('Future#mapRej', 0, 'be a function', f);
return new FutureMapRej(this, f);

@@ -269,3 +229,3 @@ };

Future.prototype.swap = function Future$swap() {
if (!isFuture(this)) error$invalidContext('Future#swap', this);
if (!isFuture(this)) invalidContext('Future#swap', this);
return new FutureSwap(this);

@@ -275,4 +235,4 @@ };

Future.prototype.race = function Future$race(m) {
if (!isFuture(this)) error$invalidContext('Future#race', this);
if (!isFuture(m)) error$invalidArgument('Future#race', 0, 'be a Future', m);
if (!isFuture(this)) invalidContext('Future#race', this);
if (!isFuture(m)) invalidArgument('Future#race', 0, 'be a Future', m);
return new FutureRace(this, m);

@@ -282,4 +242,4 @@ };

Future.prototype.and = function Future$and(m) {
if (!isFuture(this)) error$invalidContext('Future#and', this);
if (!isFuture(m)) error$invalidArgument('Future#and', 0, 'be a Future', m);
if (!isFuture(this)) invalidContext('Future#and', this);
if (!isFuture(m)) invalidArgument('Future#and', 0, 'be a Future', m);
return new FutureAnd(this, m);

@@ -289,4 +249,4 @@ };

Future.prototype.or = function Future$or(m) {
if (!isFuture(this)) error$invalidContext('Future#or', this);
if (!isFuture(m)) error$invalidArgument('Future#or', 0, 'be a Future', m);
if (!isFuture(this)) invalidContext('Future#or', this);
if (!isFuture(m)) invalidArgument('Future#or', 0, 'be a Future', m);
return new FutureOr(this, m);

@@ -296,4 +256,4 @@ };

Future.prototype.both = function Future$both(m) {
if (!isFuture(this)) error$invalidContext('Future#both', this);
if (!isFuture(m)) error$invalidArgument('Future#both', 0, 'be a Future', m);
if (!isFuture(this)) invalidContext('Future#both', this);
if (!isFuture(m)) invalidArgument('Future#both', 0, 'be a Future', m);
return new FutureBoth(this, m);

@@ -303,5 +263,5 @@ };

Future.prototype.fold = function Future$fold(f, g) {
if (!isFuture(this)) error$invalidContext('Future#fold', this);
if (!isFunction(f)) error$invalidArgument('Future#fold', 0, 'be a function', f);
if (!isFunction(g)) error$invalidArgument('Future#fold', 1, 'be a function', g);
if (!isFuture(this)) invalidContext('Future#fold', this);
if (!isFunction(f)) invalidArgument('Future#fold', 0, 'be a function', f);
if (!isFunction(g)) invalidArgument('Future#fold', 1, 'be a function', g);
return new FutureFold(this, f, g);

@@ -311,5 +271,5 @@ };

Future.prototype.hook = function Future$hook(dispose, consume) {
if (!isFuture(this)) error$invalidContext('Future#hook', this);
if (!isFunction(dispose)) error$invalidArgument('Future#hook', 0, 'be a function', dispose);
if (!isFunction(consume)) error$invalidArgument('Future#hook', 1, 'be a function', consume);
if (!isFuture(this)) invalidContext('Future#hook', this);
if (!isFunction(dispose)) invalidArgument('Future#hook', 0, 'be a function', dispose);
if (!isFunction(consume)) invalidArgument('Future#hook', 1, 'be a function', consume);
return new FutureHook(this, dispose, consume);

@@ -319,4 +279,4 @@ };

Future.prototype.finally = function Future$finally(m) {
if (!isFuture(this)) error$invalidContext('Future#finally', this);
if (!isFuture(m)) error$invalidArgument('Future#finally', 0, 'be a Future', m);
if (!isFuture(this)) invalidContext('Future#finally', this);
if (!isFuture(m)) invalidArgument('Future#finally', 0, 'be a Future', m);
return new FutureFinally(this, m);

@@ -326,3 +286,3 @@ };

Future.prototype.cache = function Future$cache() {
if (!isFuture(this)) error$invalidContext('Future#cache', this);
if (!isFuture(this)) invalidContext('Future#cache', this);
return new CachedFuture(this);

@@ -332,15 +292,11 @@ };

Future.prototype.fork = function Future$fork(rej, res) {
if (!isFuture(this)) error$invalidContext('Future#fork', this);
if (!isFunction(rej)) error$invalidArgument('Future#fork', 0, 'be a function', rej);
if (!isFunction(res)) error$invalidArgument('Future#fork', 1, 'be a function', res);
if (!isFuture(this)) invalidContext('Future#fork', this);
if (!isFunction(rej)) invalidArgument('Future#fork', 0, 'be a function', rej);
if (!isFunction(res)) invalidArgument('Future#fork', 1, 'be a function', res);
return this._f(rej, res);
};
Future.prototype.inspect = function Future$inspect() {
return this.toString();
};
Future.prototype.value = function Future$value(f) {
if (!isFuture(this)) error$invalidContext('Future#value', this);
if (!isFunction(f)) error$invalidArgument('Future#value', 0, 'be a function', f);
if (!isFuture(this)) invalidContext('Future#value', this);
if (!isFunction(f)) invalidArgument('Future#value', 0, 'be a function', f);
return this._f(function Future$value$rej(e) {

@@ -352,3 +308,3 @@ throw new Error('Future#value was called on a rejected Future\n Actual: Future.reject(' + show(e) + ')');

Future.prototype.promise = function Future$promise() {
if (!isFuture(this)) error$invalidContext('Future#promise', this);
if (!isFuture(this)) invalidContext('Future#promise', this);
var _this = this;

@@ -364,6 +320,5 @@ return new Promise(function Future$promise$do(resolve, reject) {

Future.isFuture = isFuture;
Future.isForkable = isForkable;
function ap$mval(mval, mfunc) {
if (!Z.Apply.test(mfunc)) error$invalidArgument('Future.ap', 1, 'be an Apply', mfunc);
if (!Z.Apply.test(mfunc)) invalidArgument('Future.ap', 1, 'be an Apply', mfunc);
return Z.ap(mval, mfunc);

@@ -373,3 +328,3 @@ }

Future.ap = function ap(mval, mfunc) {
if (!Z.Apply.test(mval)) error$invalidArgument('Future.ap', 0, 'be an Apply', mval);
if (!Z.Apply.test(mval)) invalidArgument('Future.ap', 0, 'be an Apply', mval);
if (arguments.length === 1) return unaryPartial(ap$mval, mval);

@@ -380,3 +335,3 @@ return ap$mval(mval, mfunc);

function map$mapper(mapper, m) {
if (!Z.Functor.test(m)) error$invalidArgument('Future.map', 1, 'be a Functor', m);
if (!Z.Functor.test(m)) invalidArgument('Future.map', 1, 'be a Functor', m);
return Z.map(mapper, m);

@@ -386,3 +341,3 @@ }

Future.map = function map(mapper, m) {
if (!isFunction(mapper)) error$invalidArgument('Future.map', 0, 'be a Function', mapper);
if (!isFunction(mapper)) invalidArgument('Future.map', 0, 'be a Function', mapper);
if (arguments.length === 1) return unaryPartial(map$mapper, mapper);

@@ -393,3 +348,3 @@ return map$mapper(mapper, m);

function bimap$lmapper$rmapper(lmapper, rmapper, m) {
if (!Z.Bifunctor.test(m)) error$invalidArgument('Future.bimap', 2, 'be a Bifunctor', m);
if (!Z.Bifunctor.test(m)) invalidArgument('Future.bimap', 2, 'be a Bifunctor', m);
return Z.bimap(lmapper, rmapper, m);

@@ -399,3 +354,3 @@ }

function bimap$lmapper(lmapper, rmapper, m) {
if (!isFunction(rmapper)) error$invalidArgument('Future.bimap', 1, 'be a Function', rmapper);
if (!isFunction(rmapper)) invalidArgument('Future.bimap', 1, 'be a Function', rmapper);
if (arguments.length === 2) return binaryPartial(bimap$lmapper$rmapper, lmapper, rmapper);

@@ -406,4 +361,5 @@ return bimap$lmapper$rmapper(lmapper, rmapper, m);

Future.bimap = function bimap(lmapper, rmapper, m) {
if (!isFunction(lmapper)) error$invalidArgument('Future.bimap', 0, 'be a Function', lmapper);
if (!isFunction(lmapper)) invalidArgument('Future.bimap', 0, 'be a Function', lmapper);
if (arguments.length === 1) return unaryPartial(bimap$lmapper, lmapper);
if (arguments.length === 2) return bimap$lmapper(lmapper, rmapper);
return bimap$lmapper(lmapper, rmapper, m);

@@ -413,3 +369,3 @@ };

function chain$chainer(chainer, m) {
if (!Z.Chain.test(m)) error$invalidArgument('Future.chain', 1, 'be a Chain', m);
if (!Z.Chain.test(m)) invalidArgument('Future.chain', 1, 'be a Chain', m);
return Z.chain(chainer, m);

@@ -419,3 +375,3 @@ }

Future.chain = function chain(chainer, m) {
if (!isFunction(chainer)) error$invalidArgument('Future.chain', 0, 'be a Function', chainer);
if (!isFunction(chainer)) invalidArgument('Future.chain', 0, 'be a Function', chainer);
if (arguments.length === 1) return unaryPartial(chain$chainer, chainer);

@@ -426,3 +382,3 @@ return chain$chainer(chainer, m);

function and$left(left, right) {
if (!isFuture(right)) error$invalidArgument('Future.and', 1, 'be a Future', right);
if (!isFuture(right)) invalidArgument('Future.and', 1, 'be a Future', right);
return new FutureAnd(left, right);

@@ -432,3 +388,3 @@ }

Future.and = function and(left, right) {
if (!isFuture(left)) error$invalidArgument('Future.and', 0, 'be a Future', left);
if (!isFuture(left)) invalidArgument('Future.and', 0, 'be a Future', left);
if (arguments.length === 1) return unaryPartial(and$left, left);

@@ -439,3 +395,3 @@ return and$left(left, right);

function both$left(left, right) {
if (!isFuture(right)) error$invalidArgument('Future.both', 1, 'be a Future', right);
if (!isFuture(right)) invalidArgument('Future.both', 1, 'be a Future', right);
return new FutureBoth(left, right);

@@ -445,3 +401,3 @@ }

Future.both = function both(left, right) {
if (!isFuture(left)) error$invalidArgument('Future.both', 0, 'be a Future', left);
if (!isFuture(left)) invalidArgument('Future.both', 0, 'be a Future', left);
if (arguments.length === 1) return unaryPartial(both$left, left);

@@ -460,3 +416,3 @@ return both$left(left, right);

Future.after = function Future$after(n, x) {
if (!isPositiveInteger(n)) error$invalidArgument('Future.after', 0, 'be a positive integer', n);
if (!isPositiveInteger(n)) invalidArgument('Future.after', 0, 'be a positive integer', n);
if (arguments.length === 1) return unaryPartial(Future$after$n, n);

@@ -471,3 +427,3 @@ return Future$after$n(n, x);

Future.rejectAfter = function rejectAfter(time, reason) {
if (!isPositiveInteger(time)) error$invalidArgument('Future.rejectAfter', 0, 'be a positive integer', time);
if (!isPositiveInteger(time)) invalidArgument('Future.rejectAfter', 0, 'be a positive integer', time);
if (arguments.length === 1) return unaryPartial(rejectAfter$time, time);

@@ -478,8 +434,17 @@ return rejectAfter$time(time, reason);

Future.cast = function Future$cast(m) {
deprecate('Future.cast has been renamed to Future.fromForkable and will soon be removed');
return Future.fromForkable(m);
deprecate('Future.cast() is deprecated. Please use Future((l, r) => {m.fork(l, r)})');
return new SafeFuture(function (l, r) {
return void m.fork(l, r);
});
};
Future.fromForkable = function Future$fromForkable(m) {
deprecate('Future.fromForkable() is deprecated. Please use Future((l, r) => {m.fork(l, r)})');
return new SafeFuture(function (l, r) {
return void m.fork(l, r);
});
};
Future.try = function Future$try(f) {
if (!isFunction(f)) error$invalidArgument('Future.try', 0, 'be a function', f);
if (!isFunction(f)) invalidArgument('Future.try', 0, 'be a function', f);
return new FutureTry(f);

@@ -490,3 +455,3 @@ };

if (arguments.length === 1) return unaryPartial(Future$encase, f);
if (!isFunction(f)) error$invalidArgument('Future.encase', 0, 'be a function', f);
if (!isFunction(f)) invalidArgument('Future.encase', 0, 'be a function', f);
return new FutureEncase(f, x);

@@ -502,4 +467,4 @@ };

default:
if (!isFunction(f)) error$invalidArgument('Future.encase2', 0, 'be a function', f);
if (!isBinary(f)) error$invalidArgument('Future.encase2', 0, 'take two arguments', f);
if (!isFunction(f)) invalidArgument('Future.encase2', 0, 'be a function', f);
if (!isBinary(f)) invalidArgument('Future.encase2', 0, 'take two arguments', f);
return new FutureEncase(f, x, y);

@@ -518,4 +483,4 @@ }

default:
if (!isFunction(f)) error$invalidArgument('Future.encase3', 0, 'be a function', f);
if (!isTernary(f)) error$invalidArgument('Future.encase3', 0, 'take three arguments', f);
if (!isFunction(f)) invalidArgument('Future.encase3', 0, 'be a function', f);
if (!isTernary(f)) invalidArgument('Future.encase3', 0, 'take three arguments', f);
return new FutureEncase(f, x, y, z);

@@ -525,10 +490,5 @@ }

Future.fromForkable = function Future$fromForkable(f) {
if (!isForkable(f)) error$invalidArgument('Future.fromForkable', 0, 'be a forkable', f);
return new FutureFromForkable(f);
};
Future.fromPromise = function Future$fromPromise(f, x) {
if (arguments.length === 1) return unaryPartial(Future$fromPromise, f);
if (!isFunction(f)) error$invalidArgument('Future.fromPromise', 0, 'be a function', f);
if (!isFunction(f)) invalidArgument('Future.fromPromise', 0, 'be a function', f);
return new FutureFromPromise(f, x);

@@ -544,4 +504,4 @@ };

default:
if (!isFunction(f)) error$invalidArgument('Future.fromPromise2', 0, 'be a function', f);
if (!isBinary(f)) error$invalidArgument('Future.fromPromise2', 0, 'take two arguments', f);
if (!isFunction(f)) invalidArgument('Future.fromPromise2', 0, 'be a function', f);
if (!isBinary(f)) invalidArgument('Future.fromPromise2', 0, 'take two arguments', f);
return new FutureFromPromise(f, x, y);

@@ -560,4 +520,4 @@ }

default:
if (!isFunction(f)) error$invalidArgument('Future.fromPromise3', 0, 'be a function', f);
if (!isTernary(f)) error$invalidArgument('Future.fromPromise3', 0, 'take three arguments', f);
if (!isFunction(f)) invalidArgument('Future.fromPromise3', 0, 'be a function', f);
if (!isTernary(f)) invalidArgument('Future.fromPromise3', 0, 'take three arguments', f);
return new FutureFromPromise(f, x, y, z);

@@ -568,33 +528,167 @@ }

Future.node = function Future$node(f) {
if (!isFunction(f)) error$invalidArgument('Future.node', 0, 'be a function', f);
if (!isFunction(f)) invalidArgument('Future.node', 0, 'be a function', f);
return new FutureNode(f);
};
Future.parallel = function Future$parallel(i, ms) {
if (arguments.length === 1) return unaryPartial(Future$parallel, i);
if (!isPositiveInteger(i)) error$invalidArgument('Future.parallel', 0, 'be a positive integer', i);
if (!Array.isArray(ms)) error$invalidArgument('Future.parallel', 1, 'be an array', ms);
function parallel$i(i, ms) {
if (!Array.isArray(ms)) invalidArgument('Future.parallel', 1, 'be an array', ms);
return new FutureParallel(i, ms);
}
Future.parallel = function parallel(i, ms) {
if (!isPositiveInteger(i)) invalidArgument('Future.parallel', 0, 'be a positive integer', i);
if (arguments.length === 1) return unaryPartial(parallel$i, i);
return parallel$i(i, ms);
};
Future.do = function Future$do(f) {
if (!isFunction(f)) error$invalidArgument('Future.do', 0, 'be a function', f);
if (!isFunction(f)) invalidArgument('Future.do', 0, 'be a function', f);
return new FutureDo(f);
};
Future.chainRej = createUnaryDispatcher('chainRej');
Future.mapRej = createUnaryDispatcher('mapRej');
Future.swap = createNullaryDispatcher('swap');
Future.fork = createBinaryDispatcher('fork');
Future.race = createUnaryDispatcher('race');
Future.or = createUnaryDispatcher('or');
Future.fold = createBinaryDispatcher('fold');
Future.hook = createInvertedBinaryDispatcher('hook');
Future.finally = createUnaryDispatcher('finally');
Future.value = createUnaryDispatcher('value');
Future.promise = createNullaryDispatcher('promise');
Future.cache = createNullaryDispatcher('cache');
Future.extractLeft = createNullaryDispatcher('extractLeft');
Future.extractRight = createNullaryDispatcher('extractRight');
function chainRej$chainer(chainer, m) {
if (!isFuture(m)) invalidArgument('Future.chainRej', 1, 'be a Future', m);
return new FutureChainRej(chainer, m);
}
Future.chainRej = function chainRej(chainer, m) {
if (!isFunction(chainer)) invalidArgument('Future.chainRej', 0, 'be a Function', chainer);
if (arguments.length === 1) return unaryPartial(chainRej$chainer, chainer);
return chainRej$chainer(chainer, m);
};
function mapRej$mapper(mapper, m) {
if (!isFuture(m)) invalidArgument('Future.mapRej', 1, 'be a Future', m);
return new FutureMapRej(mapper, m);
}
Future.mapRej = function mapRej(mapper, m) {
if (!isFunction(mapper)) invalidArgument('Future.mapRej', 0, 'be a Function', mapper);
if (arguments.length === 1) return unaryPartial(mapRej$mapper, mapper);
return mapRej$mapper(mapper, m);
};
function race$left(left, right) {
if (!isFuture(right)) invalidArgument('Future.race', 1, 'be a Future', right);
return new FutureRace(left, right);
}
Future.race = function race(left, right) {
if (!isFuture(left)) invalidArgument('Future.race', 0, 'be a Future', left);
if (arguments.length === 1) return unaryPartial(race$left, left);
return race$left(left, right);
};
function or$right(right, left) {
if (!isFuture(left)) invalidArgument('Future.or', 1, 'be a Future', left);
return new FutureOr(left, right);
}
Future.or = function or(right, left) {
if (!isFuture(right)) invalidArgument('Future.or', 0, 'be a Future', right);
if (arguments.length === 1) return unaryPartial(or$right, right);
return or$right(right, left);
};
function finally$left(left, right) {
if (!isFuture(right)) invalidArgument('Future.finally', 1, 'be a Future', right);
return new FutureFinally(left, right);
}
Future.finally = function finally$(left, right) {
if (!isFuture(left)) invalidArgument('Future.finally', 0, 'be a Future', left);
if (arguments.length === 1) return unaryPartial(finally$left, left);
return finally$left(left, right);
};
function value$cont(cont, m) {
if (!isFuture(m)) invalidArgument('Future.value', 1, 'be a Future', m);
return m.value(cont);
}
Future.value = function value(cont, m) {
if (!isFunction(cont)) invalidArgument('Future.value', 0, 'be a Function', cont);
if (arguments.length === 1) return unaryPartial(value$cont, cont);
return value$cont(cont, m);
};
Future.swap = function swap(m) {
if (!isFuture(m)) invalidArgument('Future.swap', 0, 'be a Future', m);
return new FutureSwap(m);
};
Future.promise = function promise(m) {
if (!isFuture(m)) invalidArgument('Future.promise', 0, 'be a Future', m);
return m.promise();
};
Future.cache = function cache(m) {
if (!isFuture(m)) invalidArgument('Future.cache', 0, 'be a Future', m);
return new CachedFuture(m);
};
Future.extractLeft = function extractLeft(m) {
if (!isFuture(m)) invalidArgument('Future.extractLeft', 0, 'be a Future', m);
return m.extractLeft();
};
Future.extractRight = function extractRight(m) {
if (!isFuture(m)) invalidArgument('Future.extractRight', 0, 'be a Future', m);
return m.extractRight();
};
function fork$f$g(f, g, m) {
if (!isFuture(m)) invalidArgument('Future.fork', 2, 'be a Future', m);
return m._f(f, g);
}
function fork$f(f, g, m) {
if (!isFunction(g)) invalidArgument('Future.fork', 1, 'be a function', g);
if (arguments.length === 2) return binaryPartial(fork$f$g, f, g);
return fork$f$g(f, g, m);
}
Future.fork = function fork(f, g, m) {
if (!isFunction(f)) invalidArgument('Future.fork', 0, 'be a function', f);
if (arguments.length === 1) return unaryPartial(fork$f, f);
if (arguments.length === 2) return fork$f(f, g);
return fork$f(f, g, m);
};
function fold$f$g(f, g, m) {
if (!isFuture(m)) invalidArgument('Future.fold', 2, 'be a Future', m);
return new FutureFold(f, g, m);
}
function fold$f(f, g, m) {
if (!isFunction(g)) invalidArgument('Future.fold', 1, 'be a function', g);
if (arguments.length === 2) return binaryPartial(fold$f$g, f, g);
return fold$f$g(f, g, m);
}
Future.fold = function fold(f, g, m) {
if (!isFunction(f)) invalidArgument('Future.fold', 0, 'be a function', f);
if (arguments.length === 1) return unaryPartial(fold$f, f);
if (arguments.length === 2) return fold$f(f, g);
return fold$f(f, g, m);
};
function hook$acquire$cleanup(acquire, cleanup, consume) {
if (!isFunction(consume)) invalidArgument('Future.hook', 2, 'be a Future', consume);
return new FutureHook(acquire, cleanup, consume);
}
function hook$acquire(acquire, cleanup, consume) {
if (!isFunction(cleanup)) invalidArgument('Future.hook', 1, 'be a function', cleanup);
if (arguments.length === 2) return binaryPartial(hook$acquire$cleanup, acquire, cleanup);
return hook$acquire$cleanup(acquire, cleanup, consume);
}
Future.hook = function hook(acquire, cleanup, consume) {
if (!isFuture(acquire)) invalidArgument('Future.hook', 0, 'be a Future', acquire);
if (arguments.length === 1) return unaryPartial(hook$acquire, acquire);
if (arguments.length === 2) return hook$acquire(acquire, cleanup);
return hook$acquire(acquire, cleanup, consume);
};
//Utilities.

@@ -729,13 +823,2 @@ Future.util = {

//data State = Cold | Pending | Rejected | Resolved
var Cold = 0;
var Pending = 1;
var Rejected = 2;
var Resolved = 3;
function Queued(rej, res) {
this[Rejected] = rej;
this[Resolved] = res;
}
function CachedFuture(pure) {

@@ -750,4 +833,12 @@ this._pure = pure;

CachedFuture.STATE = (_CachedFuture$STATE = {}, _defineProperty(_CachedFuture$STATE, Cold, 'cold'), _defineProperty(_CachedFuture$STATE, Pending, 'pending'), _defineProperty(_CachedFuture$STATE, Rejected, 'rejected'), _defineProperty(_CachedFuture$STATE, Resolved, 'resolved'), _CachedFuture$STATE);
var Cold = CachedFuture.Cold = 0;
var Pending = CachedFuture.Pending = 1;
var Rejected = CachedFuture.Rejected = 2;
var Resolved = CachedFuture.Resolved = 3;
function Queued(rej, res) {
this[Rejected] = rej;
this[Resolved] = res;
}
CachedFuture.prototype = Object.create(Future.prototype);

@@ -826,6 +917,2 @@

CachedFuture.prototype.getState = function CachedFuture$getState() {
return CachedFuture.STATE[this._state];
};
CachedFuture.prototype._f = function CachedFuture$fork(rej, res) {

@@ -847,7 +934,2 @@ var _this = this;

CachedFuture.prototype.inspect = function CachedFuture$inspect() {
var repr = this._state === Resolved ? show(this._value) : '<' + this.getState() + '>' + (this._state === Rejected ? ' ' + show(this._value) : '');
return 'CachedFuture({ ' + repr + ' })';
};
CachedFuture.prototype.toString = function CachedFuture$toString() {

@@ -1025,3 +1107,3 @@ return this._pure.toString() + '.cache()';

function check$do$g(g) {
if (!isIterator(g)) error$invalidArgument('Future.do', 0, 'return an iterator, maybe you forgot the "*"', g);
if (!isIterator(g)) invalidArgument('Future.do', 0, 'return an iterator, maybe you forgot the "*"', g);
}

@@ -1057,29 +1139,2 @@

function FutureFromForkable(forkable) {
this._forkable = forkable;
}
FutureFromForkable.prototype = Object.create(Future.prototype);
FutureFromForkable.prototype._f = function FutureFromForkable$fork(rej, res) {
var pending = true;
return this._forkable.fork(function FutureFromForkable$fork$rej(reason) {
if (pending) {
pending = false;
rej(reason);
}
}, function FutureFromForkable$res(value) {
if (pending) {
pending = false;
res(value);
}
});
};
FutureFromForkable.prototype.toString = function FutureFromForkable$toString() {
return 'Future.fromForkable(' + show(this._forkable) + ')';
};
//----------
function FutureTry(fn) {

@@ -1631,3 +1686,2 @@ this._fn = fn;

FutureEncase: FutureEncase,
FutureFromForkable: FutureFromForkable,
FutureFromPromise: FutureFromPromise,

@@ -1634,0 +1688,0 @@ FutureChain: FutureChain,

@@ -43,2 +43,3 @@ //// ____ _ _

function isForkable(m){
deprecate('Future.isForkable() is deprecated');
return Boolean(m) && typeof m.fork === 'function' && m.fork.length >= 2;

@@ -117,41 +118,4 @@ }

//Creates a dispatcher for a nullary method.
function createNullaryDispatcher(method){
return function nullaryDispatch(m){
if(m && typeof m[method] === 'function') return m[method]();
return error$invalidArgument(`Future.${method}`, 1, `have a "${method}" method`, m);
};
}
//Creates a dispatcher for a unary method.
function createUnaryDispatcher(method){
return function unaryDispatch(a, m){
if(arguments.length === 1) return unaryPartial(unaryDispatch, a);
if(m && typeof m[method] === 'function') return m[method](a);
return error$invalidArgument(`Future.${method}`, 1, `have a "${method}" method`, m);
};
}
//Creates a dispatcher for a binary method.
function createBinaryDispatcher(method){
return function binaryDispatch(a, b, m){
if(arguments.length === 1) return unaryPartial(binaryDispatch, a);
if(arguments.length === 2) return binaryPartial(binaryDispatch, a, b);
if(m && typeof m[method] === 'function') return m[method](a, b);
return error$invalidArgument(`Future.${method}`, 2, `have a "${method}" method`, m);
};
}
//Creates a dispatcher for a binary method, but takes the object first rather than last.
function createInvertedBinaryDispatcher(method){
return function invertedBinaryDispatch(m, a, b){
if(arguments.length === 1) return unaryPartial(invertedBinaryDispatch, m);
if(arguments.length === 2) return binaryPartial(invertedBinaryDispatch, m, a);
if(m && typeof m[method] === 'function') return m[method](a, b);
return error$invalidArgument(`Future.${method}`, 0, `have a "${method}" method`, m);
};
}
//Creates an error about an invalid argument.
function error$invalidArgument(it, at, expected, actual){
function invalidArgument(it, at, expected, actual){
throw new TypeError(

@@ -163,3 +127,3 @@ `${it} expects its ${ordinal[at]} argument to ${expected}\n Actual: ${show(actual)}`

//Creates an error message about a method being called with an invalid context.
function error$invalidContext(it, actual){
function invalidContext(it, actual){
throw new TypeError(

@@ -176,3 +140,3 @@ `${it} was invoked outside the context of a Future. You might want to use`

function Future(f){
if(!isFunction(f)) error$invalidArgument('Future', 0, 'be a function', f);
if(!isFunction(f)) invalidArgument('Future', 0, 'be a function', f);
return new SafeFuture(f);

@@ -187,3 +151,3 @@ }

if(arguments.length === 1) return unaryPartial(Future$chainRec, f);
if(!isFunction(f)) error$invalidArgument('Future.chainRec', 0, 'be a function', f);
if(!isFunction(f)) invalidArgument('Future.chainRec', 0, 'be a function', f);
return new ChainRec(f, init);

@@ -199,4 +163,4 @@ }

Future.prototype.ap = function Future$ap(m){
if(!isFuture(this)) error$invalidContext('Future#ap', this);
if(!isFuture(m)) error$invalidArgument('Future#ap', 0, 'be a Future', m);
if(!isFuture(this)) invalidContext('Future#ap', this);
if(!isFuture(m)) invalidArgument('Future#ap', 0, 'be a Future', m);
return new FutureAp(this, m);

@@ -206,4 +170,4 @@ };

Future.prototype.map = function Future$map(f){
if(!isFuture(this)) error$invalidContext('Future#map', this);
if(!isFunction(f)) error$invalidArgument('Future#map', 0, 'be a function', f);
if(!isFuture(this)) invalidContext('Future#map', this);
if(!isFunction(f)) invalidArgument('Future#map', 0, 'be a function', f);
return new FutureMap(this, f);

@@ -213,5 +177,5 @@ };

Future.prototype.bimap = function Future$bimap(f, g){
if(!isFuture(this)) error$invalidContext('Future#bimap', this);
if(!isFunction(f)) error$invalidArgument('Future#bimap', 0, 'be a function', f);
if(!isFunction(g)) error$invalidArgument('Future#bimap', 1, 'be a function', g);
if(!isFuture(this)) invalidContext('Future#bimap', this);
if(!isFunction(f)) invalidArgument('Future#bimap', 0, 'be a function', f);
if(!isFunction(g)) invalidArgument('Future#bimap', 1, 'be a function', g);
return new FutureBimap(this, f, g);

@@ -221,4 +185,4 @@ };

Future.prototype.chain = function Future$chain(f){
if(!isFuture(this)) error$invalidContext('Future#chain', this);
if(!isFunction(f)) error$invalidArgument('Future#chain', 0, 'be a function', f);
if(!isFuture(this)) invalidContext('Future#chain', this);
if(!isFunction(f)) invalidArgument('Future#chain', 0, 'be a function', f);
return new FutureChain(this, f);

@@ -228,4 +192,4 @@ };

Future.prototype.chainRej = function Future$chainRej(f){
if(!isFuture(this)) error$invalidContext('Future.chainRej', this);
if(!isFunction(f)) error$invalidArgument('Future.chainRej', 0, 'a function', f);
if(!isFuture(this)) invalidContext('Future.chainRej', this);
if(!isFunction(f)) invalidArgument('Future.chainRej', 0, 'a function', f);
return new FutureChainRej(this, f);

@@ -235,4 +199,4 @@ };

Future.prototype.mapRej = function Future$mapRej(f){
if(!isFuture(this)) error$invalidContext('Future#mapRej', this);
if(!isFunction(f)) error$invalidArgument('Future#mapRej', 0, 'be a function', f);
if(!isFuture(this)) invalidContext('Future#mapRej', this);
if(!isFunction(f)) invalidArgument('Future#mapRej', 0, 'be a function', f);
return new FutureMapRej(this, f);

@@ -242,3 +206,3 @@ };

Future.prototype.swap = function Future$swap(){
if(!isFuture(this)) error$invalidContext('Future#swap', this);
if(!isFuture(this)) invalidContext('Future#swap', this);
return new FutureSwap(this);

@@ -248,4 +212,4 @@ };

Future.prototype.race = function Future$race(m){
if(!isFuture(this)) error$invalidContext('Future#race', this);
if(!isFuture(m)) error$invalidArgument('Future#race', 0, 'be a Future', m);
if(!isFuture(this)) invalidContext('Future#race', this);
if(!isFuture(m)) invalidArgument('Future#race', 0, 'be a Future', m);
return new FutureRace(this, m);

@@ -255,4 +219,4 @@ };

Future.prototype.and = function Future$and(m){
if(!isFuture(this)) error$invalidContext('Future#and', this);
if(!isFuture(m)) error$invalidArgument('Future#and', 0, 'be a Future', m);
if(!isFuture(this)) invalidContext('Future#and', this);
if(!isFuture(m)) invalidArgument('Future#and', 0, 'be a Future', m);
return new FutureAnd(this, m);

@@ -262,4 +226,4 @@ };

Future.prototype.or = function Future$or(m){
if(!isFuture(this)) error$invalidContext('Future#or', this);
if(!isFuture(m)) error$invalidArgument('Future#or', 0, 'be a Future', m);
if(!isFuture(this)) invalidContext('Future#or', this);
if(!isFuture(m)) invalidArgument('Future#or', 0, 'be a Future', m);
return new FutureOr(this, m);

@@ -269,4 +233,4 @@ };

Future.prototype.both = function Future$both(m){
if(!isFuture(this)) error$invalidContext('Future#both', this);
if(!isFuture(m)) error$invalidArgument('Future#both', 0, 'be a Future', m);
if(!isFuture(this)) invalidContext('Future#both', this);
if(!isFuture(m)) invalidArgument('Future#both', 0, 'be a Future', m);
return new FutureBoth(this, m);

@@ -276,5 +240,5 @@ };

Future.prototype.fold = function Future$fold(f, g){
if(!isFuture(this)) error$invalidContext('Future#fold', this);
if(!isFunction(f)) error$invalidArgument('Future#fold', 0, 'be a function', f);
if(!isFunction(g)) error$invalidArgument('Future#fold', 1, 'be a function', g);
if(!isFuture(this)) invalidContext('Future#fold', this);
if(!isFunction(f)) invalidArgument('Future#fold', 0, 'be a function', f);
if(!isFunction(g)) invalidArgument('Future#fold', 1, 'be a function', g);
return new FutureFold(this, f, g);

@@ -284,5 +248,5 @@ };

Future.prototype.hook = function Future$hook(dispose, consume){
if(!isFuture(this)) error$invalidContext('Future#hook', this);
if(!isFunction(dispose)) error$invalidArgument('Future#hook', 0, 'be a function', dispose);
if(!isFunction(consume)) error$invalidArgument('Future#hook', 1, 'be a function', consume);
if(!isFuture(this)) invalidContext('Future#hook', this);
if(!isFunction(dispose)) invalidArgument('Future#hook', 0, 'be a function', dispose);
if(!isFunction(consume)) invalidArgument('Future#hook', 1, 'be a function', consume);
return new FutureHook(this, dispose, consume);

@@ -292,4 +256,4 @@ };

Future.prototype.finally = function Future$finally(m){
if(!isFuture(this)) error$invalidContext('Future#finally', this);
if(!isFuture(m)) error$invalidArgument('Future#finally', 0, 'be a Future', m);
if(!isFuture(this)) invalidContext('Future#finally', this);
if(!isFuture(m)) invalidArgument('Future#finally', 0, 'be a Future', m);
return new FutureFinally(this, m);

@@ -299,3 +263,3 @@ };

Future.prototype.cache = function Future$cache(){
if(!isFuture(this)) error$invalidContext('Future#cache', this);
if(!isFuture(this)) invalidContext('Future#cache', this);
return new CachedFuture(this);

@@ -305,15 +269,11 @@ };

Future.prototype.fork = function Future$fork(rej, res){
if(!isFuture(this)) error$invalidContext('Future#fork', this);
if(!isFunction(rej)) error$invalidArgument('Future#fork', 0, 'be a function', rej);
if(!isFunction(res)) error$invalidArgument('Future#fork', 1, 'be a function', res);
if(!isFuture(this)) invalidContext('Future#fork', this);
if(!isFunction(rej)) invalidArgument('Future#fork', 0, 'be a function', rej);
if(!isFunction(res)) invalidArgument('Future#fork', 1, 'be a function', res);
return this._f(rej, res);
};
Future.prototype.inspect = function Future$inspect(){
return this.toString();
};
Future.prototype.value = function Future$value(f){
if(!isFuture(this)) error$invalidContext('Future#value', this);
if(!isFunction(f)) error$invalidArgument('Future#value', 0, 'be a function', f);
if(!isFuture(this)) invalidContext('Future#value', this);
if(!isFunction(f)) invalidArgument('Future#value', 0, 'be a function', f);
return this._f(function Future$value$rej(e){

@@ -327,3 +287,3 @@ throw new Error(

Future.prototype.promise = function Future$promise(){
if(!isFuture(this)) error$invalidContext('Future#promise', this);
if(!isFuture(this)) invalidContext('Future#promise', this);
const _this = this;

@@ -339,6 +299,5 @@ return new Promise(function Future$promise$do(resolve, reject){

Future.isFuture = isFuture;
Future.isForkable = isForkable;
function ap$mval(mval, mfunc){
if(!Z.Apply.test(mfunc)) error$invalidArgument('Future.ap', 1, 'be an Apply', mfunc);
if(!Z.Apply.test(mfunc)) invalidArgument('Future.ap', 1, 'be an Apply', mfunc);
return Z.ap(mval, mfunc);

@@ -348,3 +307,3 @@ }

Future.ap = function ap(mval, mfunc){
if(!Z.Apply.test(mval)) error$invalidArgument('Future.ap', 0, 'be an Apply', mval);
if(!Z.Apply.test(mval)) invalidArgument('Future.ap', 0, 'be an Apply', mval);
if(arguments.length === 1) return unaryPartial(ap$mval, mval);

@@ -355,3 +314,3 @@ return ap$mval(mval, mfunc);

function map$mapper(mapper, m){
if(!Z.Functor.test(m)) error$invalidArgument('Future.map', 1, 'be a Functor', m);
if(!Z.Functor.test(m)) invalidArgument('Future.map', 1, 'be a Functor', m);
return Z.map(mapper, m);

@@ -361,3 +320,3 @@ }

Future.map = function map(mapper, m){
if(!isFunction(mapper)) error$invalidArgument('Future.map', 0, 'be a Function', mapper);
if(!isFunction(mapper)) invalidArgument('Future.map', 0, 'be a Function', mapper);
if(arguments.length === 1) return unaryPartial(map$mapper, mapper);

@@ -368,3 +327,3 @@ return map$mapper(mapper, m);

function bimap$lmapper$rmapper(lmapper, rmapper, m){
if(!Z.Bifunctor.test(m)) error$invalidArgument('Future.bimap', 2, 'be a Bifunctor', m);
if(!Z.Bifunctor.test(m)) invalidArgument('Future.bimap', 2, 'be a Bifunctor', m);
return Z.bimap(lmapper, rmapper, m);

@@ -374,3 +333,3 @@ }

function bimap$lmapper(lmapper, rmapper, m){
if(!isFunction(rmapper)) error$invalidArgument('Future.bimap', 1, 'be a Function', rmapper);
if(!isFunction(rmapper)) invalidArgument('Future.bimap', 1, 'be a Function', rmapper);
if(arguments.length === 2) return binaryPartial(bimap$lmapper$rmapper, lmapper, rmapper);

@@ -381,4 +340,5 @@ return bimap$lmapper$rmapper(lmapper, rmapper, m);

Future.bimap = function bimap(lmapper, rmapper, m){
if(!isFunction(lmapper)) error$invalidArgument('Future.bimap', 0, 'be a Function', lmapper);
if(!isFunction(lmapper)) invalidArgument('Future.bimap', 0, 'be a Function', lmapper);
if(arguments.length === 1) return unaryPartial(bimap$lmapper, lmapper);
if(arguments.length === 2) return bimap$lmapper(lmapper, rmapper);
return bimap$lmapper(lmapper, rmapper, m);

@@ -388,3 +348,3 @@ };

function chain$chainer(chainer, m){
if(!Z.Chain.test(m)) error$invalidArgument('Future.chain', 1, 'be a Chain', m);
if(!Z.Chain.test(m)) invalidArgument('Future.chain', 1, 'be a Chain', m);
return Z.chain(chainer, m);

@@ -394,3 +354,3 @@ }

Future.chain = function chain(chainer, m){
if(!isFunction(chainer)) error$invalidArgument('Future.chain', 0, 'be a Function', chainer);
if(!isFunction(chainer)) invalidArgument('Future.chain', 0, 'be a Function', chainer);
if(arguments.length === 1) return unaryPartial(chain$chainer, chainer);

@@ -401,3 +361,3 @@ return chain$chainer(chainer, m);

function and$left(left, right){
if(!isFuture(right)) error$invalidArgument('Future.and', 1, 'be a Future', right);
if(!isFuture(right)) invalidArgument('Future.and', 1, 'be a Future', right);
return new FutureAnd(left, right);

@@ -407,3 +367,3 @@ }

Future.and = function and(left, right){
if(!isFuture(left)) error$invalidArgument('Future.and', 0, 'be a Future', left);
if(!isFuture(left)) invalidArgument('Future.and', 0, 'be a Future', left);
if(arguments.length === 1) return unaryPartial(and$left, left);

@@ -414,3 +374,3 @@ return and$left(left, right);

function both$left(left, right){
if(!isFuture(right)) error$invalidArgument('Future.both', 1, 'be a Future', right);
if(!isFuture(right)) invalidArgument('Future.both', 1, 'be a Future', right);
return new FutureBoth(left, right);

@@ -420,3 +380,3 @@ }

Future.both = function both(left, right){
if(!isFuture(left)) error$invalidArgument('Future.both', 0, 'be a Future', left);
if(!isFuture(left)) invalidArgument('Future.both', 0, 'be a Future', left);
if(arguments.length === 1) return unaryPartial(both$left, left);

@@ -435,3 +395,3 @@ return both$left(left, right);

Future.after = function Future$after(n, x){
if(!isPositiveInteger(n)) error$invalidArgument('Future.after', 0, 'be a positive integer', n);
if(!isPositiveInteger(n)) invalidArgument('Future.after', 0, 'be a positive integer', n);
if(arguments.length === 1) return unaryPartial(Future$after$n, n);

@@ -446,3 +406,3 @@ return Future$after$n(n, x);

Future.rejectAfter = function rejectAfter(time, reason){
if(!isPositiveInteger(time)) error$invalidArgument(
if(!isPositiveInteger(time)) invalidArgument(
'Future.rejectAfter', 0, 'be a positive integer', time

@@ -455,8 +415,13 @@ );

Future.cast = function Future$cast(m){
deprecate('Future.cast has been renamed to Future.fromForkable and will soon be removed');
return Future.fromForkable(m);
deprecate('Future.cast() is deprecated. Please use Future((l, r) => {m.fork(l, r)})');
return new SafeFuture((l, r) => void m.fork(l, r));
};
Future.fromForkable = function Future$fromForkable(m){
deprecate('Future.fromForkable() is deprecated. Please use Future((l, r) => {m.fork(l, r)})');
return new SafeFuture((l, r) => void m.fork(l, r));
};
Future.try = function Future$try(f){
if(!isFunction(f)) error$invalidArgument('Future.try', 0, 'be a function', f);
if(!isFunction(f)) invalidArgument('Future.try', 0, 'be a function', f);
return new FutureTry(f);

@@ -467,3 +432,3 @@ };

if(arguments.length === 1) return unaryPartial(Future$encase, f);
if(!isFunction(f)) error$invalidArgument('Future.encase', 0, 'be a function', f);
if(!isFunction(f)) invalidArgument('Future.encase', 0, 'be a function', f);
return new FutureEncase(f, x);

@@ -477,4 +442,4 @@ };

default:
if(!isFunction(f)) error$invalidArgument('Future.encase2', 0, 'be a function', f);
if(!isBinary(f)) error$invalidArgument('Future.encase2', 0, 'take two arguments', f);
if(!isFunction(f)) invalidArgument('Future.encase2', 0, 'be a function', f);
if(!isBinary(f)) invalidArgument('Future.encase2', 0, 'take two arguments', f);
return new FutureEncase(f, x, y);

@@ -490,4 +455,4 @@ }

default:
if(!isFunction(f)) error$invalidArgument('Future.encase3', 0, 'be a function', f);
if(!isTernary(f)) error$invalidArgument('Future.encase3', 0, 'take three arguments', f);
if(!isFunction(f)) invalidArgument('Future.encase3', 0, 'be a function', f);
if(!isTernary(f)) invalidArgument('Future.encase3', 0, 'take three arguments', f);
return new FutureEncase(f, x, y, z);

@@ -497,10 +462,5 @@ }

Future.fromForkable = function Future$fromForkable(f){
if(!isForkable(f)) error$invalidArgument('Future.fromForkable', 0, 'be a forkable', f);
return new FutureFromForkable(f);
};
Future.fromPromise = function Future$fromPromise(f, x){
if(arguments.length === 1) return unaryPartial(Future$fromPromise, f);
if(!isFunction(f)) error$invalidArgument('Future.fromPromise', 0, 'be a function', f);
if(!isFunction(f)) invalidArgument('Future.fromPromise', 0, 'be a function', f);
return new FutureFromPromise(f, x);

@@ -514,4 +474,4 @@ };

default:
if(!isFunction(f)) error$invalidArgument('Future.fromPromise2', 0, 'be a function', f);
if(!isBinary(f)) error$invalidArgument('Future.fromPromise2', 0, 'take two arguments', f);
if(!isFunction(f)) invalidArgument('Future.fromPromise2', 0, 'be a function', f);
if(!isBinary(f)) invalidArgument('Future.fromPromise2', 0, 'take two arguments', f);
return new FutureFromPromise(f, x, y);

@@ -528,5 +488,5 @@ }

if(!isFunction(f))
error$invalidArgument('Future.fromPromise3', 0, 'be a function', f);
invalidArgument('Future.fromPromise3', 0, 'be a function', f);
if(!isTernary(f))
error$invalidArgument('Future.fromPromise3', 0, 'take three arguments', f);
invalidArgument('Future.fromPromise3', 0, 'take three arguments', f);
return new FutureFromPromise(f, x, y, z);

@@ -537,35 +497,167 @@ }

Future.node = function Future$node(f){
if(!isFunction(f)) error$invalidArgument('Future.node', 0, 'be a function', f);
if(!isFunction(f)) invalidArgument('Future.node', 0, 'be a function', f);
return new FutureNode(f);
};
Future.parallel = function Future$parallel(i, ms){
if(arguments.length === 1) return unaryPartial(Future$parallel, i);
if(!isPositiveInteger(i))
error$invalidArgument('Future.parallel', 0, 'be a positive integer', i);
if(!Array.isArray(ms))
error$invalidArgument('Future.parallel', 1, 'be an array', ms);
function parallel$i(i, ms){
if(!Array.isArray(ms)) invalidArgument('Future.parallel', 1, 'be an array', ms);
return new FutureParallel(i, ms);
}
Future.parallel = function parallel(i, ms){
if(!isPositiveInteger(i)) invalidArgument('Future.parallel', 0, 'be a positive integer', i);
if(arguments.length === 1) return unaryPartial(parallel$i, i);
return parallel$i(i, ms);
};
Future.do = function Future$do(f){
if(!isFunction(f)) error$invalidArgument('Future.do', 0, 'be a function', f);
if(!isFunction(f)) invalidArgument('Future.do', 0, 'be a function', f);
return new FutureDo(f);
};
Future.chainRej = createUnaryDispatcher('chainRej');
Future.mapRej = createUnaryDispatcher('mapRej');
Future.swap = createNullaryDispatcher('swap');
Future.fork = createBinaryDispatcher('fork');
Future.race = createUnaryDispatcher('race');
Future.or = createUnaryDispatcher('or');
Future.fold = createBinaryDispatcher('fold');
Future.hook = createInvertedBinaryDispatcher('hook');
Future.finally = createUnaryDispatcher('finally');
Future.value = createUnaryDispatcher('value');
Future.promise = createNullaryDispatcher('promise');
Future.cache = createNullaryDispatcher('cache');
Future.extractLeft = createNullaryDispatcher('extractLeft');
Future.extractRight = createNullaryDispatcher('extractRight');
function chainRej$chainer(chainer, m){
if(!isFuture(m)) invalidArgument('Future.chainRej', 1, 'be a Future', m);
return new FutureChainRej(chainer, m);
}
Future.chainRej = function chainRej(chainer, m){
if(!isFunction(chainer)) invalidArgument('Future.chainRej', 0, 'be a Function', chainer);
if(arguments.length === 1) return unaryPartial(chainRej$chainer, chainer);
return chainRej$chainer(chainer, m);
};
function mapRej$mapper(mapper, m){
if(!isFuture(m)) invalidArgument('Future.mapRej', 1, 'be a Future', m);
return new FutureMapRej(mapper, m);
}
Future.mapRej = function mapRej(mapper, m){
if(!isFunction(mapper)) invalidArgument('Future.mapRej', 0, 'be a Function', mapper);
if(arguments.length === 1) return unaryPartial(mapRej$mapper, mapper);
return mapRej$mapper(mapper, m);
};
function race$left(left, right){
if(!isFuture(right)) invalidArgument('Future.race', 1, 'be a Future', right);
return new FutureRace(left, right);
}
Future.race = function race(left, right){
if(!isFuture(left)) invalidArgument('Future.race', 0, 'be a Future', left);
if(arguments.length === 1) return unaryPartial(race$left, left);
return race$left(left, right);
};
function or$right(right, left){
if(!isFuture(left)) invalidArgument('Future.or', 1, 'be a Future', left);
return new FutureOr(left, right);
}
Future.or = function or(right, left){
if(!isFuture(right)) invalidArgument('Future.or', 0, 'be a Future', right);
if(arguments.length === 1) return unaryPartial(or$right, right);
return or$right(right, left);
};
function finally$left(left, right){
if(!isFuture(right)) invalidArgument('Future.finally', 1, 'be a Future', right);
return new FutureFinally(left, right);
}
Future.finally = function finally$(left, right){
if(!isFuture(left)) invalidArgument('Future.finally', 0, 'be a Future', left);
if(arguments.length === 1) return unaryPartial(finally$left, left);
return finally$left(left, right);
};
function value$cont(cont, m){
if(!isFuture(m)) invalidArgument('Future.value', 1, 'be a Future', m);
return m.value(cont);
}
Future.value = function value(cont, m){
if(!isFunction(cont)) invalidArgument('Future.value', 0, 'be a Function', cont);
if(arguments.length === 1) return unaryPartial(value$cont, cont);
return value$cont(cont, m);
};
Future.swap = function swap(m){
if(!isFuture(m)) invalidArgument('Future.swap', 0, 'be a Future', m);
return new FutureSwap(m);
};
Future.promise = function promise(m){
if(!isFuture(m)) invalidArgument('Future.promise', 0, 'be a Future', m);
return m.promise();
};
Future.cache = function cache(m){
if(!isFuture(m)) invalidArgument('Future.cache', 0, 'be a Future', m);
return new CachedFuture(m);
};
Future.extractLeft = function extractLeft(m){
if(!isFuture(m)) invalidArgument('Future.extractLeft', 0, 'be a Future', m);
return m.extractLeft();
};
Future.extractRight = function extractRight(m){
if(!isFuture(m)) invalidArgument('Future.extractRight', 0, 'be a Future', m);
return m.extractRight();
};
function fork$f$g(f, g, m){
if(!isFuture(m)) invalidArgument('Future.fork', 2, 'be a Future', m);
return m._f(f, g);
}
function fork$f(f, g, m){
if(!isFunction(g)) invalidArgument('Future.fork', 1, 'be a function', g);
if(arguments.length === 2) return binaryPartial(fork$f$g, f, g);
return fork$f$g(f, g, m);
}
Future.fork = function fork(f, g, m){
if(!isFunction(f)) invalidArgument('Future.fork', 0, 'be a function', f);
if(arguments.length === 1) return unaryPartial(fork$f, f);
if(arguments.length === 2) return fork$f(f, g);
return fork$f(f, g, m);
};
function fold$f$g(f, g, m){
if(!isFuture(m)) invalidArgument('Future.fold', 2, 'be a Future', m);
return new FutureFold(f, g, m);
}
function fold$f(f, g, m){
if(!isFunction(g)) invalidArgument('Future.fold', 1, 'be a function', g);
if(arguments.length === 2) return binaryPartial(fold$f$g, f, g);
return fold$f$g(f, g, m);
}
Future.fold = function fold(f, g, m){
if(!isFunction(f)) invalidArgument('Future.fold', 0, 'be a function', f);
if(arguments.length === 1) return unaryPartial(fold$f, f);
if(arguments.length === 2) return fold$f(f, g);
return fold$f(f, g, m);
};
function hook$acquire$cleanup(acquire, cleanup, consume){
if(!isFunction(consume)) invalidArgument('Future.hook', 2, 'be a Future', consume);
return new FutureHook(acquire, cleanup, consume);
}
function hook$acquire(acquire, cleanup, consume){
if(!isFunction(cleanup)) invalidArgument('Future.hook', 1, 'be a function', cleanup);
if(arguments.length === 2) return binaryPartial(hook$acquire$cleanup, acquire, cleanup);
return hook$acquire$cleanup(acquire, cleanup, consume);
}
Future.hook = function hook(acquire, cleanup, consume){
if(!isFuture(acquire)) invalidArgument('Future.hook', 0, 'be a Future', acquire);
if(arguments.length === 1) return unaryPartial(hook$acquire, acquire);
if(arguments.length === 2) return hook$acquire(acquire, cleanup);
return hook$acquire(acquire, cleanup, consume);
};
//Utilities.

@@ -715,13 +807,2 @@ Future.util = {

//data State = Cold | Pending | Rejected | Resolved
const Cold = 0;
const Pending = 1;
const Rejected = 2;
const Resolved = 3;
function Queued(rej, res){
this[Rejected] = rej;
this[Resolved] = res;
}
function CachedFuture(pure){

@@ -736,9 +817,12 @@ this._pure = pure;

CachedFuture.STATE = {
[Cold]: 'cold',
[Pending]: 'pending',
[Rejected]: 'rejected',
[Resolved]: 'resolved'
};
const Cold = CachedFuture.Cold = 0;
const Pending = CachedFuture.Pending = 1;
const Rejected = CachedFuture.Rejected = 2;
const Resolved = CachedFuture.Resolved = 3;
function Queued(rej, res){
this[Rejected] = rej;
this[Resolved] = res;
}
CachedFuture.prototype = Object.create(Future.prototype);

@@ -816,6 +900,2 @@

CachedFuture.prototype.getState = function CachedFuture$getState(){
return CachedFuture.STATE[this._state];
};
CachedFuture.prototype._f = function CachedFuture$fork(rej, res){

@@ -833,9 +913,2 @@ const _this = this;

CachedFuture.prototype.inspect = function CachedFuture$inspect(){
const repr = this._state === Resolved
? show(this._value)
: `<${this.getState()}>` + (this._state === Rejected ? ` ${show(this._value)}` : '');
return `CachedFuture({ ${repr} })`;
};
CachedFuture.prototype.toString = function CachedFuture$toString(){

@@ -1005,3 +1078,3 @@ return `${this._pure.toString()}.cache()`;

function check$do$g(g){
if(!isIterator(g)) error$invalidArgument(
if(!isIterator(g)) invalidArgument(
'Future.do', 0, 'return an iterator, maybe you forgot the "*"', g

@@ -1047,29 +1120,2 @@ );

function FutureFromForkable(forkable){
this._forkable = forkable;
}
FutureFromForkable.prototype = Object.create(Future.prototype);
FutureFromForkable.prototype._f = function FutureFromForkable$fork(rej, res){
let pending = true;
return this._forkable.fork(function FutureFromForkable$fork$rej(reason){
if(pending){
pending = false;
rej(reason);
}
}, function FutureFromForkable$res(value){
if(pending){
pending = false;
res(value);
}
});
};
FutureFromForkable.prototype.toString = function FutureFromForkable$toString(){
return `Future.fromForkable(${show(this._forkable)})`;
};
//----------
function FutureTry(fn){

@@ -1578,3 +1624,2 @@ this._fn = fn;

FutureEncase,
FutureFromForkable,
FutureFromPromise,

@@ -1581,0 +1626,0 @@ FutureChain,

{
"name": "fluture",
"version": "4.3.1",
"version": "4.3.2",
"description": "FantasyLand compliant (monadic) alternative to Promises",

@@ -16,14 +16,11 @@ "main": "fluture.js",

"lint:readme": "remark --no-stdout --frail -u remark-validate-links README.md",
"postcheckout": "npm install",
"postmerge": "npm install",
"precommit": "npm run lint && npm run lint:readme && npm run test:unit",
"prepublish": "npm run build",
"release": "npm outdated --long && xyz --edit --repo git@github.com:Avaq/Fluture.git --tag 'X.Y.Z' --increment",
"toc": "node scripts/toc.js",
"test": "npm run test:all && codecov",
"test": "npm run test:all && npm run test:coverage && codecov",
"test:opt": "node --allow-natives-syntax --trace-opt --trace-deopt --trace-inlining scripts/test-opt",
"test:mem": "node scripts/test-mem",
"test:all": "npm run lint && npm run lint:readme && npm run test:unit && npm run test:coverage",
"test:all": "npm run lint && npm run lint:readme && npm run test:unit",
"test:unit": "_mocha --ui bdd --reporter list --check-leaks --full-trace test/**.test.js",
"test:coverage": "npm run clean && istanbul cover --report html _mocha -- --ui bdd --reporter dot --bail test/**.test.js"
"test:coverage": "npm run clean && istanbul cover --report html _mocha -- --ui bdd --reporter dot --check-leaks --bail test/**.test.js"
},

@@ -73,3 +70,2 @@ "author": "Aldwin Vlasblom <aldwin.vlasblom@gmail.com> (https://github.com/Avaq)",

"fun-task": "^1.5.1",
"husky": "^0.13.1",
"istanbul": "^0.4.2",

@@ -76,0 +72,0 @@ "jsverify": "^0.7.1",

@@ -13,14 +13,11 @@ # [![Fluture](logo.png)](#butterfly)

Much like Promises, Futures represent the value arising from the success or
failure of an asynchronous operation (I/O). Though unlike Promises Futures are
*lazy* and *monadic* by design. They conform to the [Fantasy Land][FL] algebraic
JavaScript specification.
failure of an asynchronous operation (I/O). Though unlike Promises, Futures are
*lazy* and adhere to [the *monadic* interface](#interoperability).
Fluture boasts the following features:
* Fine-grained control over asynchronous flow through generic monadic
transformations and an array of control utilities.
* [Cancellation](#future).
* [Resource management utilities](#resource-management).
* Plays nicely with functional libraries such as [Ramda][20] and [Sanctuary][21].
* Provides a pleasant debugging experience through informative error messages.
* Great integration with functional libraries such as [Sanctuary][S].
* A pleasant debugging experience through informative error messages.
* Considerable performance benefits over Promises and the likes.

@@ -30,5 +27,5 @@

* [Wiki: Compare Futures to Promises][22]
* [Wiki: Compare Fluture to similar libraries][15]
* [Video: Monad a Day by @DrBoolean - Futures][23]
* [Wiki: Compare Futures to Promises][wiki:promises]
* [Wiki: Compare Fluture to similar libraries][wiki:similar]
* [Video: Monad a Day by @DrBoolean - Futures][5]

@@ -69,3 +66,2 @@ ## Usage

* [encase](#encase)
* [fromForkable](#fromforkable)
* [fromPromise](#frompromise)

@@ -99,3 +95,2 @@ * [node](#node)

* [isFuture](#isfuture)
* [isForkable](#isforkable)
* [cache](#cache)

@@ -111,6 +106,6 @@ * [do](#do)

[<img src="https://raw.github.com/fantasyland/fantasy-land/master/logo.png" align="right" width="82" height="82" alt="Fantasy Land" />][FL]
[<img src="https://raw.githubusercontent.com/rpominov/static-land/master/logo/logo.png" align="right" height="82" alt="Static Land" />][25]
[<img src="https://raw.githubusercontent.com/rpominov/static-land/master/logo/logo.png" align="right" height="82" alt="Static Land" />][6]
Fluture implements [FantasyLand 1][FL1], [FantasyLand 2][FL2],
[FantasyLand 3][FL3] and [Static Land][25] compatible `Functor`, `Bifunctor`,
[FantasyLand 3][FL3] and [Static Land][6] compatible `Functor`, `Bifunctor`,
`Apply`, `Applicative`, `Chain`, `ChainRec` and `Monad`.

@@ -125,3 +120,3 @@

[Hindley-Milner][9] type signatures are used to document functions. Signatures
[Hindley-Milner][2] type signatures are used to document functions. Signatures
starting with a `.` refer to "static" functions, whereas signatures starting

@@ -132,17 +127,14 @@ with a `#` refer to functions on the prototype.

- **Forkable** - Any Object with a `fork` method that takes at least two
arguments. This includes instances of Fluture, instances of Task from
[`data.task`][10] or instances of Future from [`ramda-fantasy`][11].
- **Future** - Instances of Future provided by Fluture.
- **Promise** - Values which conform to the [Promises/A+ specification][33].
- **Functor** - Values which conform to the [Fantasy Land Functor specification][12]
as determined by [Sanctuary Type Classes][27].
- **Bifunctor** - Values which conform to the [Fantasy Land Bifunctor specification][24]
as determined by [Sanctuary Type Classes][28].
- **Chain** - Values which conform to the [Fantasy Land Chain specification][13]
as determined by [Sanctuary Type Classes][29].
- **Apply** - Values which conform to the [Fantasy Land Apply specification][14]
as determined by [Sanctuary Type Classes][30].
- **Iterator** - Objects with `next`-methods which conform to the [Iterator protocol][18].
- **Iteration** - `{done, value}`-Objects as defined by the [Iterator protocol][18].
- **Promise** - Values which conform to the [Promises/A+ specification][7].
- **Functor** - Values which conform to the [Fantasy Land Functor specification][FL:functor]
as determined by [Sanctuary Type Classes][Z:Functor].
- **Bifunctor** - Values which conform to the [Fantasy Land Bifunctor specification][FL:bifunctor]
as determined by [Sanctuary Type Classes][Z:Bifunctor].
- **Chain** - Values which conform to the [Fantasy Land Chain specification][FL:chain]
as determined by [Sanctuary Type Classes][Z:Chain].
- **Apply** - Values which conform to the [Fantasy Land Apply specification][FL:apply]
as determined by [Sanctuary Type Classes][Z:Apply].
- **Iterator** - Objects with `next`-methods which conform to the [Iterator protocol][3].
- **Iteration** - `{done, value}`-Objects as defined by the [Iterator protocol][3].
- **Next** - An incomplete (`{done: false}`) Iteration.

@@ -180,3 +172,3 @@ - **Done** - A complete (`{done: true}`) Iteration.

Creates a Future which immediately resolves with the given value. This function
is compliant with the [Fantasy Land Applicative specification][16].
is compliant with the [Fantasy Land Applicative specification][FL:applicative].

@@ -265,12 +257,2 @@ ```js

#### fromForkable
##### `.fromForkable :: Forkable a b -> Future a b`
Cast any [Forkable](#type-signatures) to a [Future](#type-signatures).
```js
Future.fromForkable(require('data.task').of('hello')).value(console.log);
//> "hello"
```
#### fromPromise

@@ -319,3 +301,3 @@ ##### `.fromPromise :: (a -> Promise e r) -> a -> Future e r`

Stack- and memory-safe asynchronous "recursion" based on [FantasyLand ChainRec][26].
Stack- and memory-safe asynchronous "recursion" based on [FantasyLand ChainRec][FL:chainrec].

@@ -348,3 +330,3 @@ Calls the given function with the initial value (as third argument), and expects

Future is rejected, the transformation is ignored. To learn more about the exact
behaviour of `map`, check out its [spec][12].
behaviour of `map`, check out its [spec][FL:functor].

@@ -385,3 +367,3 @@ ```js

only ever applied to the resolution value; it's ignored when the Future was
rejected. To learn more about the exact behaviour of `chain`, check out its [spec][13].
rejected. To learn more about the exact behaviour of `chain`, check out its [spec][FL:chain].

@@ -407,3 +389,3 @@ ```js

resulting Future will also be rejected. To learn more about the exact behaviour
of `ap`, check out its [spec][14].
of `ap`, check out its [spec][FL:apply].

@@ -476,3 +458,3 @@ ```js

This provides a convenient means to ensure a Future is always resolved. It can
be used with other type constructors, like [`S.Either`][7], to maintain a
be used with other type constructors, like [`S.Either`][S:Either], to maintain a
representation of failures:

@@ -788,3 +770,3 @@

Returns true for [Futures](#type-signatures) and false for everything else. This
function (and [`S.is`][17]) also return `true` for instances of Future that were
function (and [`S.is`][S:is]) also return `true` for instances of Future that were
created within other contexts. It is therefore recommended to use this over

@@ -805,7 +787,2 @@ `instanceof`, unless your intent is to explicitly check for Futures created

#### isForkable
##### `.isForkable :: a -> Boolean`
Returns true for [Forkables](#type-signatures) and false for everything else.
#### cache

@@ -837,3 +814,3 @@ ##### `.cache :: Future a b -> Future a b`

A specialized version of [fantasy-do][19] which works only for Futures, but has
A specialized version of [fantasy-do][4] which works only for Futures, but has
the advantage of type-checking and not having to pass `Future.of`. Another

@@ -863,3 +840,3 @@ advantage is that the returned Future can be forked multiple times, as opposed

Error handling is slightly different in do-notation, you need to [`fold`](#fold)
the error into your control domain, I recommend folding into an [`Either`][7]:
the error into your control domain, I recommend folding into an [`Either`][S:Either]:

@@ -883,3 +860,4 @@ ```js

When using this module with [Sanctuary][21], you might run into the following:
When using this module with [Sanctuary Def][$] (and [Sanctuary][S] by
extension) you might run into the following issue:

@@ -894,8 +872,8 @@ ```js

This happens because Sanctuary needs to know about the Future type in order to
determine whether the type-variable used in the definition of `S.I` is
consistent.
This happens because Sanctuary Def needs to know about the Future type in order
to determine whether the variable types are consistent.
To let Sanctuary know about Futures, we can provide it a `FutureType` using
[Sanctuary Def][31], and pass it to Sanctuary using [`S.create`][32]
[`BinaryType`][$:BinaryType] from Sanctuary Def, and pass it to Sanctuary using
[`S.create`][S:create]:

@@ -909,2 +887,3 @@ ```js

Future.name,
'https://github.com/Avaq/Fluture#future',
Future.isFuture,

@@ -924,3 +903,3 @@ Future.extractLeft,

To reduce the boilerplate of making Node or Promise functions return Futures
instead, one might use the [Futurize][6] library:
instead, one might use the [Futurize][1] library:

@@ -935,3 +914,3 @@ ```js

.fork(console.error, console.log);
//> "# Fluture"
//> "# [![Fluture](logo.png)](#butterfly)"
```

@@ -953,3 +932,3 @@

Credits for the logo go to [Erik Fuente][34].
Credits for the logo go to [Erik Fuente][8].

@@ -962,39 +941,36 @@ ----

[FL]: https://github.com/fantasyland/fantasy-land
[FL1]: https://github.com/fantasyland/fantasy-land/tree/v1.0.1
[FL2]: https://github.com/fantasyland/fantasy-land/tree/v2.2.0
[FL3]: https://github.com/fantasyland/fantasy-land
[wiki:similar]: https://github.com/Avaq/Fluture/wiki/Comparison-of-Future-Implementations
[wiki:promises]: https://github.com/Avaq/Fluture/wiki/Comparison-to-Promises
[2]: http://sanctuary.js.org/#pipe
[3]: http://ramdajs.com/docs/#map
[4]: http://ramdajs.com/docs/#chain
[5]: http://ramdajs.com/docs/#ap
[6]: https://github.com/futurize/futurize
[7]: http://sanctuary.js.org/#either-type
[8]: https://github.com/fantasyland/fantasy-land/pull/124
[9]: https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch7.html
[10]: https://github.com/folktale/data.task
[11]: https://github.com/ramda/ramda-fantasy
[12]: https://github.com/fantasyland/fantasy-land#functor
[13]: https://github.com/fantasyland/fantasy-land#chain
[14]: https://github.com/fantasyland/fantasy-land#apply
[15]: https://github.com/Avaq/Fluture/wiki/Comparison-of-Future-Implementations
[16]: https://github.com/fantasyland/fantasy-land#applicative
[17]: http://sanctuary.js.org/#is
[18]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterator
[19]: https://github.com/russellmcc/fantasydo
[20]: http://ramdajs.com/
[21]: http://sanctuary.js.org/
[22]: https://github.com/Avaq/Fluture/wiki/Comparison-to-Promises
[23]: https://vimeo.com/106008027
[24]: https://github.com/fantasyland/fantasy-land#bifunctor
[25]: https://github.com/rpominov/static-land
[26]: https://github.com/fantasyland/fantasy-land#chainrec
[27]: https://github.com/sanctuary-js/sanctuary-type-classes#Functor
[28]: https://github.com/sanctuary-js/sanctuary-type-classes#Bifunctor
[29]: https://github.com/sanctuary-js/sanctuary-type-classes#Chain
[30]: https://github.com/sanctuary-js/sanctuary-type-classes#Apply
[31]: https://github.com/sanctuary-js/sanctuary-def#binarytype
[32]: https://sanctuary.js.org/#create
[33]: https://promisesaplus.com/
[34]: http://erikfuente.com/
[FL]: https://github.com/fantasyland/fantasy-land
[FL1]: https://github.com/fantasyland/fantasy-land/tree/v1.0.1
[FL2]: https://github.com/fantasyland/fantasy-land/tree/v2.2.0
[FL3]: https://github.com/fantasyland/fantasy-land
[FL:functor]: https://github.com/fantasyland/fantasy-land#functor
[FL:chain]: https://github.com/fantasyland/fantasy-land#chain
[FL:apply]: https://github.com/fantasyland/fantasy-land#apply
[FL:applicative]: https://github.com/fantasyland/fantasy-land#applicative
[FL:bifunctor]: https://github.com/fantasyland/fantasy-land#bifunctor
[FL:chainrec]: https://github.com/fantasyland/fantasy-land#chainrec
[S]: https://sanctuary.js.org/
[S:Either]: https://sanctuary.js.org/#either-type
[S:is]: https://sanctuary.js.org/#is
[S:create]: https://sanctuary.js.org/#create
[Z:Functor]: https://github.com/sanctuary-js/sanctuary-type-classes#Functor
[Z:Bifunctor]: https://github.com/sanctuary-js/sanctuary-type-classes#Bifunctor
[Z:Chain]: https://github.com/sanctuary-js/sanctuary-type-classes#Chain
[Z:Apply]: https://github.com/sanctuary-js/sanctuary-type-classes#Apply
[$]: https://github.com/sanctuary-js/sanctuary-def
[$:BinaryType]: https://github.com/sanctuary-js/sanctuary-def#BinaryType
[1]: https://github.com/futurize/futurize
[2]: https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch7.html
[3]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterator
[4]: https://github.com/russellmcc/fantasydo
[5]: https://vimeo.com/106008027
[6]: https://github.com/rpominov/static-land
[7]: https://promisesaplus.com/
[8]: http://erikfuente.com/
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc