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 6.0.1 to 6.1.0

src/attempt.js

16

index.es.js

@@ -13,7 +13,15 @@ export {

export {after} from './src/after';
export {after, rejectAfter} from './src/after';
export {attempt, attempt as try} from './src/attempt';
export {cache} from './src/cache';
export {chainRec} from './src/chain-rec';
export {encase, encase2, encase3, attempt, attempt as try} from './src/encase';
export {encaseP, encaseP2, encaseP3, tryP} from './src/encase-p';
export {encase} from './src/encase';
export {encase2} from './src/encase2';
export {encase3} from './src/encase3';
export {encaseN} from './src/encase-n';
export {encaseN2} from './src/encase-n2';
export {encaseN3} from './src/encase-n3';
export {encaseP} from './src/encase-p';
export {encaseP2} from './src/encase-p2';
export {encaseP3} from './src/encase-p3';
export {go, go as do} from './src/go';

@@ -24,2 +32,2 @@ export {hook} from './src/hook';

export {parallel} from './src/parallel';
export {rejectAfter} from './src/reject-after';
export {tryP} from './src/try-p';

@@ -1,2 +0,2 @@

!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory(require("denque"),require("sanctuary-type-classes"),require("inspect-f"),require("sanctuary-type-identifiers"),require("concurrify")):"function"==typeof define&&define.amd?define(["denque","sanctuary-type-classes","inspect-f","sanctuary-type-identifiers","concurrify"],factory):global.Fluture=factory(global.Denque,global.sanctuaryTypeClasses,global.inspectf,global.sanctuaryTypeIdentifiers,global.concurrify)}(this,function(Denque,Z,inspectf,type,concurrify){"use strict";function Future(computation){return isFunction(computation)||invalidArgument("Future",0,"be a Function",computation),new Computation(computation)}function isFuture(x){return x instanceof Future||type(x)===$$type}function check$fork(f,c){void 0===f||isFunction(f)&&0===f.length||typeError("Future expected its computation to return a nullary function or void\n Actual: "+show(f)+"\n From calling: "+showf(c))}function Computation(computation){this._computation=computation}function Rejected(value){this._value=value}function Resolved(value){this._value=value}function Never(){}function Eager(future){var this$1=this;this.rej=noop,this.res=noop,this.rejected=!1,this.resolved=!1,this.value=null,this.cancel=future._fork(function(x){this$1.value=x,this$1.rejected=!0,this$1.cancel=noop,this$1.rej(x)},function(x){this$1.value=x,this$1.resolved=!0,this$1.cancel=noop,this$1.res(x)})}function Sequence(spawn,actions){void 0===actions&&(actions=[]),this._spawn=spawn,this._actions=actions}function ap$mval(mval,mfunc){return Z.Apply.test(mfunc)||invalidArgument("Future.ap",1,"be an Apply",mfunc),Z.ap(mval,mfunc)}function ap(mval,mfunc){return Z.Apply.test(mval)||invalidArgument("Future.ap",0,"be an Apply",mval),1===arguments.length?partial1(ap$mval,mval):ap$mval(mval,mfunc)}function map$mapper(mapper,m){return Z.Functor.test(m)||invalidArgument("Future.map",1,"be a Functor",m),Z.map(mapper,m)}function map(mapper,m){return isFunction(mapper)||invalidArgument("Future.map",0,"be a Function",mapper),1===arguments.length?partial1(map$mapper,mapper):map$mapper(mapper,m)}function bimap$lmapper$rmapper(lmapper,rmapper,m){return Z.Bifunctor.test(m)||invalidArgument("Future.bimap",2,"be a Bifunctor",m),Z.bimap(lmapper,rmapper,m)}function bimap$lmapper(lmapper,rmapper,m){return isFunction(rmapper)||invalidArgument("Future.bimap",1,"be a Function",rmapper),2===arguments.length?partial2(bimap$lmapper$rmapper,lmapper,rmapper):bimap$lmapper$rmapper(lmapper,rmapper,m)}function bimap(lmapper,rmapper,m){return isFunction(lmapper)||invalidArgument("Future.bimap",0,"be a Function",lmapper),1===arguments.length?partial1(bimap$lmapper,lmapper):2===arguments.length?bimap$lmapper(lmapper,rmapper):bimap$lmapper(lmapper,rmapper,m)}function chain$chainer(chainer,m){return Z.Chain.test(m)||invalidArgument("Future.chain",1,"be a Chain",m),Z.chain(chainer,m)}function chain(chainer,m){return isFunction(chainer)||invalidArgument("Future.chain",0,"be a Function",chainer),1===arguments.length?partial1(chain$chainer,chainer):chain$chainer(chainer,m)}function mapRej$mapper(mapper,m){return isFuture(m)||invalidFuture("Future.mapRej",1,m),m.mapRej(mapper)}function mapRej(mapper,m){return isFunction(mapper)||invalidArgument("Future.mapRej",0,"be a Function",mapper),1===arguments.length?partial1(mapRej$mapper,mapper):mapRej$mapper(mapper,m)}function chainRej$chainer(chainer,m){return isFuture(m)||invalidFuture("Future.chainRej",1,m),m.chainRej(chainer)}function chainRej(chainer,m){return isFunction(chainer)||invalidArgument("Future.chainRej",0,"be a Function",chainer),1===arguments.length?partial1(chainRej$chainer,chainer):chainRej$chainer(chainer,m)}function lastly$right(right,left){return isFuture(left)||invalidFuture("Future.finally",1,left),left.finally(right)}function lastly(right,left){return isFuture(right)||invalidFuture("Future.finally",0,right),1===arguments.length?partial1(lastly$right,right):lastly$right(right,left)}function and$left(left,right){return isFuture(right)||invalidFuture("Future.and",1,right),left.and(right)}function and(left,right){return isFuture(left)||invalidFuture("Future.and",0,left),1===arguments.length?partial1(and$left,left):and$left(left,right)}function both$left(left,right){return isFuture(right)||invalidFuture("Future.both",1,right),left.both(right)}function both(left,right){return isFuture(left)||invalidFuture("Future.both",0,left),1===arguments.length?partial1(both$left,left):both$left(left,right)}function or$left(left,right){return isFuture(right)||invalidFuture("Future.or",1,right),left.or(right)}function or(left,right){return isFuture(left)||invalidFuture("Future.or",0,left),1===arguments.length?partial1(or$left,left):or$left(left,right)}function race$right(right,left){return isFuture(left)||invalidFuture("Future.race",1,left),left.race(right)}function race(right,left){return isFuture(right)||invalidFuture("Future.race",0,right),1===arguments.length?partial1(race$right,right):race$right(right,left)}function swap(m){return isFuture(m)||invalidFuture("Future.swap",0,m),m.swap()}function fold$f$g(f,g,m){return isFuture(m)||invalidFuture("Future.fold",2,m),m.fold(f,g)}function fold$f(f,g,m){return isFunction(g)||invalidArgument("Future.fold",1,"be a function",g),2===arguments.length?partial2(fold$f$g,f,g):fold$f$g(f,g,m)}function fold(f,g,m){return isFunction(f)||invalidArgument("Future.fold",0,"be a function",f),1===arguments.length?partial1(fold$f,f):2===arguments.length?fold$f(f,g):fold$f(f,g,m)}function fork$f$g(f,g,m){return isFuture(m)||invalidFuture("Future.fork",2,m),m._fork(f,g)}function fork$f(f,g,m){return isFunction(g)||invalidArgument("Future.fork",1,"be a function",g),2===arguments.length?partial2(fork$f$g,f,g):fork$f$g(f,g,m)}function fork(f,g,m){return isFunction(f)||invalidArgument("Future.fork",0,"be a function",f),1===arguments.length?partial1(fork$f,f):2===arguments.length?fork$f(f,g):fork$f(f,g,m)}function promise(m){return isFuture(m)||invalidFuture("Future.promise",0,m),m.promise()}function value$cont(cont,m){return isFuture(m)||invalidFuture("Future.value",1,m),m.value(cont)}function value(cont,m){return isFunction(cont)||invalidArgument("Future.value",0,"be a Function",cont),1===arguments.length?partial1(value$cont,cont):value$cont(cont,m)}function extractLeft(m){return isFuture(m)||invalidFuture("Future.extractLeft",0,m),m.extractLeft()}function extractRight(m){return isFuture(m)||invalidFuture("Future.extractRight",0,m),m.extractRight()}function RejectAfter(time,value){this._time=time,this._value=value}function rejectAfter$time(time,reason){return time===1/0?never:new RejectAfter(time,reason)}function rejectAfter(time,reason){return isUnsigned(time)||invalidArgument("Future.rejectAfter",0,"be a positive integer",time),1===arguments.length?partial1(rejectAfter$time,time):rejectAfter$time(time,reason)}function After(time,value){this._time=time,this._value=value}function Future$after$n(n,x){return n===1/0?never:new After(n,x)}function after(n,x){return isUnsigned(n)||invalidArgument("Future.after",0,"be a positive integer",n),1===arguments.length?partial1(Future$after$n,n):Future$after$n(n,x)}function Queued(rej,res){this[Rejected$1]=rej,this[Resolved$1]=res}function Cached(pure){this._pure=pure,this.reset()}function cache(m){return isFuture(m)||invalidFuture("Future.cache",0,m),new Cached(m)}function ChainRec(step,init){this._step=step,this._init=init}function chainRec(step,init){return new ChainRec(step,init)}function Encase$0$fork(rej,res){var r;try{r=this._fn()}catch(e){return rej(e),noop}return res(r),noop}function Encase$1$fork(rej,res){var r;try{r=this._fn(this._a)}catch(e){return rej(e),noop}return res(r),noop}function Encase$2$fork(rej,res){var r;try{r=this._fn(this._a,this._b)}catch(e){return rej(e),noop}return res(r),noop}function Encase$3$fork(rej,res){var r;try{r=this._fn(this._a,this._b,this._c)}catch(e){return rej(e),noop}return res(r),noop}function Encase(fn,a,b,c){this._length=arguments.length-1,this._fn=fn,this._a=a,this._b=b,this._c=c,this._fork=forks[this._length]}function attempt(f){return isFunction(f)||invalidArgument("Future.try",0,"be a function",f),new Encase(f)}function encase(f,x){return isFunction(f)||invalidArgument("Future.encase",0,"be a function",f),1===arguments.length?partial1(encase,f):new Encase(f,x)}function encase2(f,x,y){switch(isFunction(f)||invalidArgument("Future.encase2",0,"be a function",f),arguments.length){case 1:return partial1(encase2,f);case 2:return partial2(encase2,f,x);default:return new Encase(f,x,y)}}function encase3(f,x,y,z){switch(isFunction(f)||invalidArgument("Future.encase3",0,"be a function",f),arguments.length){case 1:return partial1(encase3,f);case 2:return partial2(encase3,f,x);case 3:return partial3(encase3,f,x,y);default:return new Encase(f,x,y,z)}}function escape(f){return function(x){setTimeout(function(){f(x)},0)}}function check$promise(p,f,a,b,c){return isThenable(p)?p:typeError("Future.encaseP expects the function its given to return a Promise/Thenable\n Actual: "+show(p)+"\n From calling: "+showf(f)+"\n With a: "+show(a)+(arguments.length>3?"\n With b: "+show(b):"")+(arguments.length>4?"\n With c: "+show(c):""))}function EncaseP$0$fork(rej,res){var ref=this,_fn=ref._fn;return check$promise(_fn(),_fn).then(escape(res),escape(rej)),noop}function EncaseP$1$fork(rej,res){var ref=this,_fn=ref._fn,_a=ref._a;return check$promise(_fn(_a),_fn,_a).then(escape(res),escape(rej)),noop}function EncaseP$2$fork(rej,res){var ref=this,_fn=ref._fn,_a=ref._a,_b=ref._b;return check$promise(_fn(_a,_b),_fn,_a,_b).then(escape(res),escape(rej)),noop}function EncaseP$3$fork(rej,res){var ref=this,_fn=ref._fn,_a=ref._a,_b=ref._b,_c=ref._c;return check$promise(_fn(_a,_b,_c),_fn,_a,_b,_c).then(escape(res),escape(rej)),noop}function EncaseP(fn,a,b,c){this._length=arguments.length-1,this._fn=fn,this._a=a,this._b=b,this._c=c,this._fork=forks$1[this._length]}function tryP(f){return isFunction(f)||invalidArgument("Future.tryP",0,"be a function",f),new EncaseP(f)}function encaseP(f,x){return isFunction(f)||invalidArgument("Future.encaseP",0,"be a function",f),1===arguments.length?partial1(encaseP,f):new EncaseP(f,x)}function encaseP2(f,x,y){switch(isFunction(f)||invalidArgument("Future.encaseP2",0,"be a function",f),arguments.length){case 1:return partial1(encaseP2,f);case 2:return partial2(encaseP2,f,x);default:return new EncaseP(f,x,y)}}function encaseP3(f,x,y,z){switch(isFunction(f)||invalidArgument("Future.encaseP3",0,"be a function",f),arguments.length){case 1:return partial1(encaseP3,f);case 2:return partial2(encaseP3,f,x);case 3:return partial3(encaseP3,f,x,y);default:return new EncaseP(f,x,y,z)}}function Go(generator){this._generator=generator}function go(generator){return isFunction(generator)||invalidArgument("Future.do",0,"be a Function",generator),new Go(generator)}function check$dispose(m,f,x){isFuture(m)||invalidFuture("Future.hook","the first function its given to return a Future",m,"\n From calling: "+showf(f)+"\n With: "+show(x))}function check$consume(m,f,x){isFuture(m)||invalidFuture("Future.hook","the second function its given to return a Future",m,"\n From calling: "+showf(f)+"\n With: "+show(x))}function Hook(acquire,dispose,consume){this._acquire=acquire,this._dispose=dispose,this._consume=consume}function hook$acquire$cleanup(acquire,cleanup,consume){return isFunction(consume)||invalidArgument("Future.hook",2,"be a Future",consume),new Hook(acquire,cleanup,consume)}function hook$acquire(acquire,cleanup,consume){return isFunction(cleanup)||invalidArgument("Future.hook",1,"be a function",cleanup),2===arguments.length?partial2(hook$acquire$cleanup,acquire,cleanup):hook$acquire$cleanup(acquire,cleanup,consume)}function hook(acquire,cleanup,consume){return isFuture(acquire)||invalidFuture("Future.hook",0,acquire),1===arguments.length?partial1(hook$acquire,acquire):2===arguments.length?hook$acquire(acquire,cleanup):hook$acquire(acquire,cleanup,consume)}function Node(computation){this._computation=computation}function node(f){return isFunction(f)||invalidArgument("Future.node",0,"be a function",f),new Node(f)}function check$ap$f(f){isFunction(f)||typeError("Future#ap expects its first argument to be a Future of a Function\n Actual: Future.of("+show(f)+")")}function ParallelAp(mval,mfunc){this._mval=mval,this._mfunc=mfunc}function isParallel(x){return x instanceof Par||type(x)===Par["@@type"]}function seq(par){return isParallel(par)||invalidArgument("Future.seq",0,"to be a Par",par),par.sequential}function Parallel(max,futures){this._futures=futures,this._length=futures.length,this._max=Math.min(this._length,max)}function parallel$max(max,xs){isArray(xs)||invalidArgument("Future.parallel",1,"be an array",xs);var futures=mapArray(xs,check$parallel);return 0===futures.length?emptyArray:new Parallel(max,futures)}function parallel(max,xs){return isUnsigned(max)||invalidArgument("Future.parallel",0,"be a positive integer",max),1===arguments.length?partial1(parallel$max,max):parallel$max(max,xs)}Denque="default"in Denque?Denque.default:Denque,Z="default"in Z?Z.default:Z,inspectf="default"in inspectf?inspectf.default:inspectf,type="default"in type?type.default:type,concurrify="default"in concurrify?concurrify.default:concurrify;var noop=function(){},moop=function(){return this},show=Z.toString,padf=function(sf,s){return s.replace(/^/gm,sf).replace(sf,"")},showf=function(f){return padf(" ",inspectf(2,f))},mapArray=function(xs,f){for(var l=xs.length,ys=new Array(l),i=0;i<l;i++)ys[i]=f(xs[i],i,xs);return ys},partial1=function(f,a){return function(b,c,d){switch(arguments.length){case 1:return f(a,b);case 2:return f(a,b,c);default:return f(a,b,c,d)}}},partial2=function(f,a,b){return function(c,d){return 1===arguments.length?f(a,b,c):f(a,b,c,d)}},partial3=function(f,a,b,c){return function(d){return f(a,b,c,d)}},isFunction=function(f){return"function"==typeof f},isThenable=function(m){return m instanceof Promise||Boolean(m)&&isFunction(m.then)},isBoolean=function(f){return"boolean"==typeof f},isNumber=function(f){return"number"==typeof f},isUnsigned=function(n){return n===1/0||isNumber(n)&&n>0&&n%1==0},isObject=function(o){return null!==o&&"object"==typeof o},isIterator=function(i){return isObject(i)&&isFunction(i.next)},isArray=Array.isArray,FL={map:"fantasy-land/map",bimap:"fantasy-land/bimap",chain:"fantasy-land/chain",chainRec:"fantasy-land/chainRec",ap:"fantasy-land/ap",of:"fantasy-land/of"},ordinal=["first","second","third","fourth","fifth"],$$type="fluture/Future@2",error=function(message){throw new Error(message)},typeError=function(message){throw new TypeError(message)},invalidArgument=function(it,at,expected,actual){return typeError(it+" expects its "+ordinal[at]+" argument to "+expected+"\n Actual: "+show(actual))},invalidContext=function(it,actual){return typeError(it+" was invoked outside the context of a Future. You might want to use a dispatcher instead\n Called on: "+show(actual))},invalidNamespace=function(m,x){return"The Future was not created by fluture. Make sure you transform other Futures to fluture Futures. Got "+(x?"a Future from "+x:"an unscoped Future")+".\n See: https://github.com/fluture-js/Fluture#casting-futures"},invalidVersion=function(m,x){return"The Future was created by "+(x<2?"an older":"a newer")+" version of fluture. This means that one of the sources which creates Futures is outdated. Update this source, or transform its created Futures to be compatible.\n See: https://github.com/fluture-js/Fluture#casting-futures"},invalidFuture=function(it,at,m,s){void 0===s&&(s="");var id=type.parse(type(m)),info="Future"===id.name?"\n"+("fluture"!==id.namespace?invalidNamespace(0,id.namespace):2!==id.version?invalidVersion(0,id.version):"Nothing seems wrong. Contact the Fluture maintainers."):"";typeError(it+" expects "+(ordinal[at]?"its "+ordinal[at]+" argument to be a valid Future":at)+"."+info+"\n Actual: "+show(m)+" :: "+id.name+s)},throwRejection=function(x){return error("Future#value was called on a rejected Future\n Actual: Future.reject("+show(x)+")")};Future.prototype[FL.ap]=function(other){return other._ap(this)},Future.prototype[FL.map]=function(mapper){return this._map(mapper)},Future.prototype[FL.bimap]=function(lmapper,rmapper){return this._bimap(lmapper,rmapper)},Future.prototype[FL.chain]=function(mapper){return this._chain(mapper)},Future.prototype.ap=function(other){return isFuture(this)||invalidContext("Future#ap",this),isFuture(other)||invalidFuture("Future#ap",0,other),this._ap(other)},Future.prototype.map=function(mapper){return isFuture(this)||invalidContext("Future#map",this),isFunction(mapper)||invalidArgument("Future#map",0,"to be a Function",mapper),this._map(mapper)},Future.prototype.bimap=function(lmapper,rmapper){return isFuture(this)||invalidContext("Future#bimap",this),isFunction(lmapper)||invalidArgument("Future#bimap",0,"to be a Function",lmapper),isFunction(rmapper)||invalidArgument("Future#bimap",1,"to be a Function",rmapper),this._bimap(lmapper,rmapper)},Future.prototype.chain=function(mapper){return isFuture(this)||invalidContext("Future#chain",this),isFunction(mapper)||invalidArgument("Future#chain",0,"to be a Function",mapper),this._chain(mapper)},Future.prototype.mapRej=function(mapper){return isFuture(this)||invalidContext("Future#mapRej",this),isFunction(mapper)||invalidArgument("Future#mapRej",0,"to be a Function",mapper),this._mapRej(mapper)},Future.prototype.chainRej=function(mapper){return isFuture(this)||invalidContext("Future#chainRej",this),isFunction(mapper)||invalidArgument("Future#chainRej",0,"to be a Function",mapper),this._chainRej(mapper)},Future.prototype.race=function(other){return isFuture(this)||invalidContext("Future#race",this),isFuture(other)||invalidFuture("Future#race",0,other),this._race(other)},Future.prototype.both=function(other){return isFuture(this)||invalidContext("Future#both",this),isFuture(other)||invalidFuture("Future#both",0,other),this._both(other)},Future.prototype.and=function(other){return isFuture(this)||invalidContext("Future#and",this),isFuture(other)||invalidFuture("Future#and",0,other),this._and(other)},Future.prototype.or=function(other){return isFuture(this)||invalidContext("Future#or",this),isFuture(other)||invalidFuture("Future#or",0,other),this._or(other)},Future.prototype.swap=function(){return isFuture(this)||invalidContext("Future#ap",this),this._swap()},Future.prototype.fold=function(lmapper,rmapper){return isFuture(this)||invalidContext("Future#ap",this),isFunction(lmapper)||invalidArgument("Future#fold",0,"to be a Function",lmapper),isFunction(rmapper)||invalidArgument("Future#fold",1,"to be a Function",rmapper),this._fold(lmapper,rmapper)},Future.prototype.finally=function(other){return isFuture(this)||invalidContext("Future#finally",this),isFuture(other)||invalidFuture("Future#finally",0,other),this._finally(other)},Future.prototype.lastly=function(other){return isFuture(this)||invalidContext("Future#lastly",this),isFuture(other)||invalidFuture("Future#lastly",0,other),this._finally(other)},Future.prototype.fork=function(rej,res){return isFuture(this)||invalidContext("Future#fork",this),isFunction(rej)||invalidArgument("Future#fork",0,"to be a Function",rej),isFunction(res)||invalidArgument("Future#fork",0,"to be a Function",res),this._fork(rej,res)},Future.prototype.value=function(res){return isFuture(this)||invalidContext("Future#value",this),isFunction(res)||invalidArgument("Future#value",0,"to be a Function",res),this._fork(throwRejection,res)},Future.prototype.promise=function(){var this$1=this;return new Promise(function(res,rej){return this$1._fork(rej,res)})},Future.prototype.isRejected=function(){return!1},Future.prototype.isResolved=function(){return!1},Future.prototype.isSettled=function(){return this.isRejected()||this.isResolved()},Future.prototype.extractLeft=function(){return[]},Future.prototype.extractRight=function(){return[]};var Core=Object.create(Future.prototype);Core._ap=function(other){return new Sequence(this,[new ApAction(other)])},Core._map=function(mapper){return new Sequence(this,[new MapAction(mapper)])},Core._bimap=function(lmapper,rmapper){return new Sequence(this,[new BimapAction(lmapper,rmapper)])},Core._chain=function(mapper){return new Sequence(this,[new ChainAction(mapper)])},Core._mapRej=function(mapper){return new Sequence(this,[new MapRejAction(mapper)])},Core._chainRej=function(mapper){return new Sequence(this,[new ChainRejAction(mapper)])},Core._race=function(other){return new Sequence(this,[new RaceAction(other)])},Core._both=function(other){return new Sequence(this,[new BothAction(other)])},Core._and=function(other){return new Sequence(this,[new AndAction(other)])},Core._or=function(other){return new Sequence(this,[new OrAction(other)])},Core._swap=function(){return new Sequence(this,[new SwapAction])},Core._fold=function(lmapper,rmapper){return new Sequence(this,[new FoldAction(lmapper,rmapper)])},Core._finally=function(other){return new Sequence(this,[new FinallyAction(other)])},Computation.prototype=Object.create(Core),Computation.prototype._fork=function(rej,res){var open=!0,f=this._computation(function(x){open&&(open=!1,rej(x))},function(x){open&&(open=!1,res(x))});return check$fork(f,this._computation),function(){open&&f&&f(),open=!1}},Computation.prototype.toString=function(){return"Future("+showf(this._computation)+")"},Rejected.prototype=Object.create(Core),Rejected.prototype._ap=moop,Rejected.prototype._map=moop,Rejected.prototype._chain=moop,Rejected.prototype._race=moop,Rejected.prototype._both=moop,Rejected.prototype._and=moop,Rejected.prototype._or=function(other){return other},Rejected.prototype._finally=function(other){return other._and(this)},Rejected.prototype._swap=function(){return new Resolved(this._value)},Rejected.prototype._fork=function(rej){return rej(this._value),noop},Rejected.prototype.isRejected=function(){return!0},Rejected.prototype.extractLeft=function(){return[this._value]},Rejected.prototype.toString=function(){return"Future.reject("+show(this._value)+")"};var reject=function(x){return new Rejected(x)};Resolved.prototype=Object.create(Core),Resolved.prototype._race=moop,Resolved.prototype._mapRej=moop,Resolved.prototype._or=moop,Resolved.prototype._and=function(other){return other},Resolved.prototype._both=function(other){var this$1=this;return other._map(function(x){return[this$1._value,x]})},Resolved.prototype._swap=function(){return new Rejected(this._value)},Resolved.prototype._finally=function(other){var this$1=this;return other._map(function(){return this$1._value})},Resolved.prototype._fork=function(rej,res){return res(this._value),noop},Resolved.prototype.isResolved=function(){return!0},Resolved.prototype.extractRight=function(){return[this._value]},Resolved.prototype.toString=function(){return"Future.of("+show(this._value)+")"};var of=function(x){return new Resolved(x)};Never.prototype=Object.create(Future.prototype),Never.prototype._ap=moop,Never.prototype._map=moop,Never.prototype._bimap=moop,Never.prototype._chain=moop,Never.prototype._mapRej=moop,Never.prototype._chainRej=moop,Never.prototype._both=moop,Never.prototype._or=moop,Never.prototype._swap=moop,Never.prototype._fold=moop,Never.prototype._finally=moop,Never.prototype._race=function(other){return other},Never.prototype._fork=function(){return noop},Never.prototype.toString=function(){return"Future.never"};var never=new Never,isNever=function(x){return x===never};Eager.prototype=Object.create(Core),Eager.prototype._fork=function(rej,res){return this.rejected?rej(this.value):this.resolved?res(this.value):(this.rej=rej,this.res=res),this.cancel};var Action=function(){};Action.prototype.rejected=function(x){return new Rejected(x)},Action.prototype.resolved=function(x){return new Resolved(x)},Action.prototype.run=function(){return this},Action.prototype.cancel=function(){};var check$ap=function(f){return isFunction(f)?f:typeError("Future#ap expects its first argument to be a Future of a Function\n Actual: Future.of("+show(f)+")")},ApAction=function(Action){function ApAction(other){Action.call(this),this.other=other}return Action&&(ApAction.__proto__=Action),ApAction.prototype=Object.create(Action&&Action.prototype),ApAction.prototype.constructor=ApAction,ApAction.prototype.resolved=function(f){return check$ap(f),this.other._map(function(x){return f(x)})},ApAction.prototype.toString=function(){return"ap("+this.other.toString()+")"},ApAction}(Action),MapAction=function(Action){function MapAction(mapper){Action.call(this),this.mapper=mapper}return Action&&(MapAction.__proto__=Action),MapAction.prototype=Object.create(Action&&Action.prototype),MapAction.prototype.constructor=MapAction,MapAction.prototype.resolved=function(x){return new Resolved(this.mapper(x))},MapAction.prototype.toString=function(){return"map("+showf(this.mapper)+")"},MapAction}(Action),BimapAction=function(Action){function BimapAction(lmapper,rmapper){Action.call(this),this.lmapper=lmapper,this.rmapper=rmapper}return Action&&(BimapAction.__proto__=Action),BimapAction.prototype=Object.create(Action&&Action.prototype),BimapAction.prototype.constructor=BimapAction,BimapAction.prototype.rejected=function(x){return new Rejected(this.lmapper(x))},BimapAction.prototype.resolved=function(x){return new Resolved(this.rmapper(x))},BimapAction.prototype.toString=function(){return"bimap("+showf(this.lmapper)+", "+showf(this.rmapper)+")"},BimapAction}(Action),check$chain=function(m,f,x){return isFuture(m)?m:invalidFuture("Future#chain","the function its given to return a Future",m,"\n From calling: "+showf(f)+"\n With: "+show(x))},ChainAction=function(Action){function ChainAction(mapper){Action.call(this),this.mapper=mapper}return Action&&(ChainAction.__proto__=Action),ChainAction.prototype=Object.create(Action&&Action.prototype),ChainAction.prototype.constructor=ChainAction,ChainAction.prototype.resolved=function(x){return check$chain(this.mapper(x),this.mapper,x)},ChainAction.prototype.toString=function(){return"chain("+showf(this.mapper)+")"},ChainAction}(Action),MapRejAction=function(Action){function MapRejAction(mapper){Action.call(this),this.mapper=mapper}return Action&&(MapRejAction.__proto__=Action),MapRejAction.prototype=Object.create(Action&&Action.prototype),MapRejAction.prototype.constructor=MapRejAction,MapRejAction.prototype.rejected=function(x){return new Rejected(this.mapper(x))},MapRejAction.prototype.toString=function(){return"mapRej("+showf(this.mapper)+")"},MapRejAction}(Action),check$chainRej=function(m,f,x){return isFuture(m)?m:invalidFuture("Future#chainRej","the function its given to return a Future",m,"\n From calling: "+showf(f)+"\n With: "+show(x))},ChainRejAction=function(Action){function ChainRejAction(mapper){Action.call(this),this.mapper=mapper}return Action&&(ChainRejAction.__proto__=Action),ChainRejAction.prototype=Object.create(Action&&Action.prototype),ChainRejAction.prototype.constructor=ChainRejAction,ChainRejAction.prototype.rejected=function(x){return check$chainRej(this.mapper(x),this.mapper,x)},ChainRejAction.prototype.toString=function(){return"chainRej("+showf(this.mapper)+")"},ChainRejAction}(Action),SwapAction=function(Action){function SwapAction(){return Action.call(this),SwapAction.instance||(SwapAction.instance=this)}return Action&&(SwapAction.__proto__=Action),SwapAction.prototype=Object.create(Action&&Action.prototype),SwapAction.prototype.constructor=SwapAction,SwapAction.prototype.rejected=function(x){return new Resolved(x)},SwapAction.prototype.resolved=function(x){return new Rejected(x)},SwapAction.prototype.toString=function(){return"swap()"},SwapAction}(Action),FoldAction=function(Action){function FoldAction(lmapper,rmapper){Action.call(this),this.lmapper=lmapper,this.rmapper=rmapper}return Action&&(FoldAction.__proto__=Action),FoldAction.prototype=Object.create(Action&&Action.prototype),FoldAction.prototype.constructor=FoldAction,FoldAction.prototype.rejected=function(x){return new Resolved(this.lmapper(x))},FoldAction.prototype.resolved=function(x){return new Resolved(this.rmapper(x))},FoldAction.prototype.toString=function(){return"fold("+showf(this.lmapper)+", "+showf(this.rmapper)+")"},FoldAction}(Action),FinallyAction=function(Action){function FinallyAction(other){Action.call(this),this.other=other}return Action&&(FinallyAction.__proto__=Action),FinallyAction.prototype=Object.create(Action&&Action.prototype),FinallyAction.prototype.constructor=FinallyAction,FinallyAction.prototype.cancel=function(){this.other._fork(noop,noop)()},FinallyAction.prototype.rejected=function(x){return this.other._and(new Rejected(x))},FinallyAction.prototype.resolved=function(x){return this.other._map(function(){return x})},FinallyAction.prototype.toString=function(){return"finally("+this.other.toString()+")"},FinallyAction}(Action),AndAction=function(Action){function AndAction(other){Action.call(this),this.other=other}return Action&&(AndAction.__proto__=Action),AndAction.prototype=Object.create(Action&&Action.prototype),AndAction.prototype.constructor=AndAction,AndAction.prototype.resolved=function(){return this.other},AndAction.prototype.toString=function(){return"and("+this.other.toString()+")"},AndAction}(Action),OrAction=function(Action){function OrAction(other){Action.call(this),this.other=other}return Action&&(OrAction.__proto__=Action),OrAction.prototype=Object.create(Action&&Action.prototype),OrAction.prototype.constructor=OrAction,OrAction.prototype.rejected=function(){return this.other},OrAction.prototype.toString=function(){return"or("+this.other.toString()+")"},OrAction}(Action),RaceAction=function(Action){function RaceAction(other){Action.call(this),this.other=other}return Action&&(RaceAction.__proto__=Action),RaceAction.prototype=Object.create(Action&&Action.prototype),RaceAction.prototype.constructor=RaceAction,RaceAction.prototype.run=function(early){return new RaceActionState(early,this.other)},RaceAction.prototype.toString=function(){return"race("+this.other.toString()+")"},RaceAction}(Action),RaceActionState=function(RaceAction){function RaceActionState(early,other){var this$1=this;RaceAction.call(this,other),this.cancel=other._fork(function(x){return early(new Rejected(x),this$1)},function(x){return early(new Resolved(x),this$1)})}return RaceAction&&(RaceActionState.__proto__=RaceAction),RaceActionState.prototype=Object.create(RaceAction&&RaceAction.prototype),RaceActionState.prototype.constructor=RaceActionState,RaceActionState.prototype.rejected=function(x){return this.cancel(),new Rejected(x)},RaceActionState.prototype.resolved=function(x){return this.cancel(),new Resolved(x)},RaceActionState}(RaceAction),BothAction=function(Action){function BothAction(other){Action.call(this),this.other=other}return Action&&(BothAction.__proto__=Action),BothAction.prototype=Object.create(Action&&Action.prototype),BothAction.prototype.constructor=BothAction,BothAction.prototype.run=function(early){return new BothActionState(early,this.other)},BothAction.prototype.resolved=function(x){return this.other._map(function(y){return[x,y]})},BothAction.prototype.toString=function(){return"both("+this.other.toString()+")"},BothAction}(Action),BothActionState=function(BothAction){function BothActionState(early,other){var this$1=this;BothAction.call(this,new Eager(other)),this.cancel=this.other.fork(function(x){return early(new Rejected(x),this$1)},noop)}return BothAction&&(BothActionState.__proto__=BothAction),BothActionState.prototype=Object.create(BothAction&&BothAction.prototype),BothActionState.prototype.constructor=BothActionState,BothActionState}(BothAction);Sequence.prototype=Object.create(Future.prototype),Sequence.prototype._transform=function(action){return new Sequence(this._spawn,this._actions.concat([action]))},Sequence.prototype._ap=function(other){return this._transform(new ApAction(other))},Sequence.prototype._map=function(mapper){return this._transform(new MapAction(mapper))},
Sequence.prototype._bimap=function(lmapper,rmapper){return this._transform(new BimapAction(lmapper,rmapper))},Sequence.prototype._chain=function(mapper){return this._transform(new ChainAction(mapper))},Sequence.prototype._mapRej=function(mapper){return this._transform(new MapRejAction(mapper))},Sequence.prototype._chainRej=function(mapper){return this._transform(new ChainRejAction(mapper))},Sequence.prototype._race=function(other){return isNever(other)?this:this._transform(new RaceAction(other))},Sequence.prototype._both=function(other){return this._transform(new BothAction(other))},Sequence.prototype._and=function(other){return this._transform(new AndAction(other))},Sequence.prototype._or=function(other){return this._transform(new OrAction(other))},Sequence.prototype._swap=function(){return this._transform(new SwapAction)},Sequence.prototype._fold=function(lmapper,rmapper){return this._transform(new FoldAction(lmapper,rmapper))},Sequence.prototype._finally=function(other){return this._transform(new FinallyAction(other))},Sequence.prototype._fork=function(rej,res){function cancelAll(){for(cancel(),action&&action.cancel();running=runners.shift();)running.cancel();actions.clear(),cancel=noop}function absorb(m){if(settled=!0,(future=m)instanceof Sequence){for(var i=future._actions.length-1;i>=0;i--)actions.unshift(future._actions[i]);future=future._spawn}}function early(m,terminator){if(cancel(),action!==terminator)for(action.cancel();(running=runners.shift())&&running!==terminator;)running.cancel();absorb(m),async&&drain()}function rejected(x){absorb(action.rejected(x)),async&&drain()}function resolved(x){absorb(action.resolved(x)),async&&drain()}function drain(){for(;action=actions.shift()||runners.shift();)if(settled=!1,async=!1,cancel=future._fork(rejected,resolved),!settled&&(action=action.run(early),!settled)){for(;running=actions.shift();){var tmp=running.run(early);if(settled)break;runners.push(tmp)}if(!settled)return void(async=!0)}cancel=future._fork(rej,res)}var action,running,settled,async,actions=new Denque(this._actions),runners=new Denque(this._actions.length),cancel=noop,future=this._spawn;return drain(),cancelAll},Sequence.prototype.toString=function(){return""+this._spawn.toString()+this._actions.map(function(x){return"."+x.toString()}).join("")},Future["@@type"]=$$type,Future[FL.of]=of;var dispatchers=Object.freeze({ap:ap,map:map,bimap:bimap,chain:chain,mapRej:mapRej,chainRej:chainRej,lastly:lastly,finally:lastly,and:and,both:both,or:or,race:race,swap:swap,fold:fold,fork:fork,promise:promise,value:value,extractLeft:extractLeft,extractRight:extractRight});RejectAfter.prototype=Object.create(Core),RejectAfter.prototype._race=function(other){return other.isSettled()?other:isNever(other)?this:other instanceof After||other instanceof RejectAfter?other._time<this._time?other:this:Core._race.call(this,other)},RejectAfter.prototype._swap=function(){return new After(this._time,this._value)},RejectAfter.prototype._fork=function(rej){var id=setTimeout(rej,this._time,this._value);return function(){clearTimeout(id)}},RejectAfter.prototype.extractLeft=function(){return[this._value]},RejectAfter.prototype.toString=function(){return"Future.rejectAfter("+show(this._time)+", "+show(this._value)+")"},After.prototype=Object.create(Core),After.prototype._race=function(other){return other.isSettled()?other:isNever(other)?this:other instanceof After||other instanceof RejectAfter?other._time<this._time?other:this:Core._race.call(this,other)},After.prototype._swap=function(){return new RejectAfter(this._time,this._value)},After.prototype._fork=function(rej,res){var id=setTimeout(res,this._time,this._value);return function(){clearTimeout(id)}},After.prototype.extractRight=function(){return[this._value]},After.prototype.toString=function(){return"Future.after("+show(this._time)+", "+show(this._value)+")"};var Cold=Cached.Cold=0,Pending=Cached.Pending=1,Rejected$1=Cached.Rejected=2,Resolved$1=Cached.Resolved=3;Cached.prototype=Object.create(Core),Cached.prototype.isRejected=function(){return this._state===Rejected$1},Cached.prototype.isResolved=function(){return this._state===Resolved$1},Cached.prototype.extractLeft=function(){return this.isRejected()?[this._value]:[]},Cached.prototype.extractRight=function(){return this.isResolved()?[this._value]:[]},Cached.prototype._addToQueue=function(rej,res){var _this=this;if(_this._state>Pending)return noop;var i=_this._queue.push(new Queued(rej,res))-1;return _this._queued=_this._queued+1,function(){_this._state>Pending||(_this._queue[i]=void 0,_this._queued=_this._queued-1,0===_this._queued&&_this.reset())}},Cached.prototype._drainQueue=function(){if(!(this._state<=Pending)&&0!==this._queued){for(var queue=this._queue,length=queue.length,state=this._state,value=this._value,i=0;i<length;i++)queue[i]&&queue[i][state](value),queue[i]=void 0;this._queue=void 0,this._queued=0}},Cached.prototype.reject=function(reason){this._state>Pending||(this._value=reason,this._state=Rejected$1,this._drainQueue())},Cached.prototype.resolve=function(value){this._state>Pending||(this._value=value,this._state=Resolved$1,this._drainQueue())},Cached.prototype.run=function(){var _this=this;_this._state>Cold||(_this._state=Pending,_this._cancel=_this._pure._fork(function(x){_this.reject(x)},function(x){_this.resolve(x)}))},Cached.prototype.reset=function(){this._state!==Cold&&(this._state>Pending&&this._cancel(),this._cancel=noop,this._queue=[],this._queued=0,this._value=void 0,this._state=Cold)},Cached.prototype._fork=function(rej,res){var cancel=noop;switch(this._state){case Pending:cancel=this._addToQueue(rej,res);break;case Rejected$1:rej(this._value);break;case Resolved$1:res(this._value);break;default:cancel=this._addToQueue(rej,res),this.run()}return cancel},Cached.prototype.toString=function(){return"Future.cache("+this._pure.toString()+")"};var Next=function(x){return{done:!1,value:x}},Done=function(x){return{done:!0,value:x}},isIteration=function(x){return isObject(x)&&isBoolean(x.done)},Undetermined=0,Synchronous=1,Asynchronous=2;ChainRec.prototype=Object.create(Core),ChainRec.prototype._fork=function(rej,res){function resolved(it){state=it,timing=timing===Undetermined?Synchronous:drain()}function drain(){for(;!state.done;){timing=Undetermined;var m=_step(Next,Done,state.value);if(cancel=m._fork(rej,resolved),timing!==Synchronous)return void(timing=Asynchronous)}res(state.value)}var ref=this,_step=ref._step,_init=ref._init,timing=Undetermined,cancel=noop,state=Next(_init);return drain(),function(){cancel()}},ChainRec.prototype.toString=function(){return"Future.chainRec("+showf(this._step)+", "+show(this._init)+")"},Future[FL.chainRec]=chainRec;var forks=[Encase$0$fork,Encase$1$fork,Encase$2$fork,Encase$3$fork];Encase.prototype=Object.create(Core),Encase.prototype.toString=function(){var args=[this._a,this._b,this._c].slice(0,this._length).map(show).map(function(x){return", "+x});return"Future."+(this._length?"encase"+(this._length>1?this._length:""):"try")+"("+show(this._fn)+args.join("")+")"};var forks$1=[EncaseP$0$fork,EncaseP$1$fork,EncaseP$2$fork,EncaseP$3$fork];EncaseP.prototype=Object.create(Core),EncaseP.prototype.toString=function(){var args=[this._a,this._b,this._c].slice(0,this._length).map(show).join(", ");return"Future.encaseP"+(this._length>1?this._length:"")+"("+show(this._fn)+", "+args+")"};var check$iterator=function(g){return isIterator(g)?g:invalidArgument("Future.do",0,'return an iterator, maybe you forgot the "*"',g)},check$iteration=function(o){return isIteration(o)||typeError("Future.do was given an invalid generator: Its iterator did not return a valid iteration from iterator.next()\n Actual: "+show(o)),o.done||isFuture(o.value)?o:invalidFuture("Future.do","the iterator to produce only valid Futures",o.value,"\n Tip: If you're using a generator, make sure you always yield a Future")};Go.prototype=Object.create(Core),Go.prototype._fork=function(rej,res){function resolved(x){if(value=x,timing===Asynchronous)return drain();timing=Synchronous,state=check$iteration(iterator.next(value))}function drain(){for(state=check$iteration(iterator.next(value));!state.done;)if(timing=Undetermined,cancel=state.value._fork(rej,resolved),timing!==Synchronous)return void(timing=Asynchronous);res(state.value)}var state,value,iterator=check$iterator(this._generator()),timing=Undetermined,cancel=noop;return drain(),function(){cancel()}},Go.prototype.toString=function(){return"Future.do("+showf(this._generator)+")"},Hook.prototype=Object.create(Core),Hook.prototype._fork=function(rej,res){function Hook$done(){cont(value)}function Hook$dispose(){var disposal=_dispose(resource);return check$dispose(disposal,_dispose,resource),cancel=disposal._fork(rej,Hook$done)}function Hook$cancelConsuption(){cancelConsume(),Hook$dispose()()}function Hook$consumptionRejected(x){cont=rej,value=x,Hook$dispose()}function Hook$consumptionResolved(x){cont=res,value=x,Hook$dispose()}function Hook$acquireResolved(x){resource=x;var consumption=_consume(resource);check$consume(consumption,_consume,resource),cancel=Hook$cancelConsuption,cancelConsume=consumption._fork(Hook$consumptionRejected,Hook$consumptionResolved)}var cancel,resource,value,ref=this,_acquire=ref._acquire,_dispose=ref._dispose,_consume=ref._consume,cancelAcquire=noop,cancelConsume=noop,cont=noop;return cancelAcquire=_acquire._fork(rej,Hook$acquireResolved),cancel=cancel||cancelAcquire,function(){cancel()}},Hook.prototype.toString=function(){var ref=this,_acquire=ref._acquire,_dispose=ref._dispose,_consume=ref._consume;return"Future.hook("+_acquire.toString()+", "+showf(_dispose)+", "+showf(_consume)+")"},Node.prototype=Object.create(Core),Node.prototype._fork=function(rej,res){var open=!0;return this._computation(function(a,b){open&&(open=!1,a?rej(a):res(b))}),function(){open=!1}},Node.prototype.toString=function(){return"Future.node("+showf(this._computation)+")"},ParallelAp.prototype=Object.create(Core),ParallelAp.prototype._fork=function(rej,res){function ParallelAp$rej(x){rejected||(rejected=!0,rej(x))}var func,val,c1,c2,okval=!1,okfunc=!1,rejected=!1;return c1=this._mval._fork(ParallelAp$rej,function(x){if(c1=noop,!okval)return okfunc=!0,void(val=x);res(func(x))}),c2=this._mfunc._fork(ParallelAp$rej,function(f){if(c2=noop,check$ap$f(f),!okfunc)return okval=!0,void(func=f);res(f(val))}),function(){c1(),c2()}},ParallelAp.prototype.toString=function(){return"new ParallelAp("+this._mval.toString()+", "+this._mfunc.toString()+")"};var Par=concurrify(Future,never,race,function(mval,mfunc){return new ParallelAp(mval,mfunc)}),check$parallel=function(m,i){return isFuture(m)?m:invalidFuture("Future.parallel","its second argument to be an array of valid Futures. The value at position "+i+" in the array is not a Future",m)};Parallel.prototype=Object.create(Core),Parallel.prototype._fork=function(rej,res){function Parallel$fork$cancelAll(){for(var n=0;n<_max;n++)cancels[n]&&cancels[n]()}function Parallel$fork$rej(reason){Parallel$fork$cancelAll(),rej(reason)}function Parallel$fork$run(future,idx,cancelSlot){cancels[cancelSlot]=future._fork(Parallel$fork$rej,function(value){out[idx]=value,i<_length?Parallel$fork$run(_futures[i],i++,cancelSlot):++i-_max===_length&&res(out)})}for(var ref=this,_futures=ref._futures,_length=ref._length,_max=ref._max,cancels=new Array(_max),out=new Array(_length),i=_max,n=0;n<_max;n++)Parallel$fork$run(_futures[n],n,n);return Parallel$fork$cancelAll},Parallel.prototype.toString=function(){return"Future.parallel("+this._max+", "+show(this._futures)+")"};var emptyArray=new Resolved([]);return"function"!=typeof Object.create&&error("Please polyfill Object.create to use Fluture"),"function"!=typeof Object.assign&&error("Please polyfill Object.assign to use Fluture"),"function"!=typeof Array.isArray&&error("Please polyfill Array.isArray to use Fluture"),Object.assign(Future,dispatchers,{Future:Future,isFuture:isFuture,reject:reject,of:of,never:never,isNever:isNever,after:after,cache:cache,encaseP:encaseP,encaseP2:encaseP2,encaseP3:encaseP3,tryP:tryP,hook:hook,node:node,Par:Par,seq:seq,parallel:parallel,rejectAfter:rejectAfter,chainRec:chainRec,encase:encase,encase2:encase2,encase3:encase3,attempt:attempt,go:go,try:attempt,do:go})});
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory(require("denque"),require("sanctuary-type-classes"),require("inspect-f"),require("sanctuary-type-identifiers"),require("concurrify")):"function"==typeof define&&define.amd?define(["denque","sanctuary-type-classes","inspect-f","sanctuary-type-identifiers","concurrify"],factory):global.Fluture=factory(global.Denque,global.sanctuaryTypeClasses,global.inspectf,global.sanctuaryTypeIdentifiers,global.concurrify)}(this,function(Denque,Z,inspectf,type,concurrify){"use strict";function Future(computation){return isFunction(computation)||invalidArgument("Future",0,"be a Function",computation),new Computation(computation)}function isFuture(x){return x instanceof Future||type(x)===$$type}function check$fork(f,c){void 0===f||isFunction(f)&&0===f.length||typeError("Future expected its computation to return a nullary function or void\n Actual: "+show(f)+"\n From calling: "+showf(c))}function Computation(computation){this._computation=computation}function Rejected(value){this._value=value}function Resolved(value){this._value=value}function Never(){}function Eager(future){var this$1=this;this.rej=noop,this.res=noop,this.rejected=!1,this.resolved=!1,this.value=null,this.cancel=future._fork(function(x){this$1.value=x,this$1.rejected=!0,this$1.cancel=noop,this$1.rej(x)},function(x){this$1.value=x,this$1.resolved=!0,this$1.cancel=noop,this$1.res(x)})}function Sequence(spawn,actions){void 0===actions&&(actions=[]),this._spawn=spawn,this._actions=actions}function ap$mval(mval,mfunc){return Z.Apply.test(mfunc)||invalidArgument("Future.ap",1,"be an Apply",mfunc),Z.ap(mval,mfunc)}function ap(mval,mfunc){return Z.Apply.test(mval)||invalidArgument("Future.ap",0,"be an Apply",mval),1===arguments.length?partial1(ap$mval,mval):ap$mval(mval,mfunc)}function map$mapper(mapper,m){return Z.Functor.test(m)||invalidArgument("Future.map",1,"be a Functor",m),Z.map(mapper,m)}function map(mapper,m){return isFunction(mapper)||invalidArgument("Future.map",0,"be a Function",mapper),1===arguments.length?partial1(map$mapper,mapper):map$mapper(mapper,m)}function bimap$lmapper$rmapper(lmapper,rmapper,m){return Z.Bifunctor.test(m)||invalidArgument("Future.bimap",2,"be a Bifunctor",m),Z.bimap(lmapper,rmapper,m)}function bimap$lmapper(lmapper,rmapper,m){return isFunction(rmapper)||invalidArgument("Future.bimap",1,"be a Function",rmapper),2===arguments.length?partial2(bimap$lmapper$rmapper,lmapper,rmapper):bimap$lmapper$rmapper(lmapper,rmapper,m)}function bimap(lmapper,rmapper,m){return isFunction(lmapper)||invalidArgument("Future.bimap",0,"be a Function",lmapper),1===arguments.length?partial1(bimap$lmapper,lmapper):2===arguments.length?bimap$lmapper(lmapper,rmapper):bimap$lmapper(lmapper,rmapper,m)}function chain$chainer(chainer,m){return Z.Chain.test(m)||invalidArgument("Future.chain",1,"be a Chain",m),Z.chain(chainer,m)}function chain(chainer,m){return isFunction(chainer)||invalidArgument("Future.chain",0,"be a Function",chainer),1===arguments.length?partial1(chain$chainer,chainer):chain$chainer(chainer,m)}function mapRej$mapper(mapper,m){return isFuture(m)||invalidFuture("Future.mapRej",1,m),m.mapRej(mapper)}function mapRej(mapper,m){return isFunction(mapper)||invalidArgument("Future.mapRej",0,"be a Function",mapper),1===arguments.length?partial1(mapRej$mapper,mapper):mapRej$mapper(mapper,m)}function chainRej$chainer(chainer,m){return isFuture(m)||invalidFuture("Future.chainRej",1,m),m.chainRej(chainer)}function chainRej(chainer,m){return isFunction(chainer)||invalidArgument("Future.chainRej",0,"be a Function",chainer),1===arguments.length?partial1(chainRej$chainer,chainer):chainRej$chainer(chainer,m)}function lastly$right(right,left){return isFuture(left)||invalidFuture("Future.finally",1,left),left.finally(right)}function lastly(right,left){return isFuture(right)||invalidFuture("Future.finally",0,right),1===arguments.length?partial1(lastly$right,right):lastly$right(right,left)}function and$left(left,right){return isFuture(right)||invalidFuture("Future.and",1,right),left.and(right)}function and(left,right){return isFuture(left)||invalidFuture("Future.and",0,left),1===arguments.length?partial1(and$left,left):and$left(left,right)}function both$left(left,right){return isFuture(right)||invalidFuture("Future.both",1,right),left.both(right)}function both(left,right){return isFuture(left)||invalidFuture("Future.both",0,left),1===arguments.length?partial1(both$left,left):both$left(left,right)}function or$left(left,right){return isFuture(right)||invalidFuture("Future.or",1,right),left.or(right)}function or(left,right){return isFuture(left)||invalidFuture("Future.or",0,left),1===arguments.length?partial1(or$left,left):or$left(left,right)}function race$right(right,left){return isFuture(left)||invalidFuture("Future.race",1,left),left.race(right)}function race(right,left){return isFuture(right)||invalidFuture("Future.race",0,right),1===arguments.length?partial1(race$right,right):race$right(right,left)}function swap(m){return isFuture(m)||invalidFuture("Future.swap",0,m),m.swap()}function fold$f$g(f,g,m){return isFuture(m)||invalidFuture("Future.fold",2,m),m.fold(f,g)}function fold$f(f,g,m){return isFunction(g)||invalidArgument("Future.fold",1,"be a function",g),2===arguments.length?partial2(fold$f$g,f,g):fold$f$g(f,g,m)}function fold(f,g,m){return isFunction(f)||invalidArgument("Future.fold",0,"be a function",f),1===arguments.length?partial1(fold$f,f):2===arguments.length?fold$f(f,g):fold$f(f,g,m)}function fork$f$g(f,g,m){return isFuture(m)||invalidFuture("Future.fork",2,m),m._fork(f,g)}function fork$f(f,g,m){return isFunction(g)||invalidArgument("Future.fork",1,"be a function",g),2===arguments.length?partial2(fork$f$g,f,g):fork$f$g(f,g,m)}function fork(f,g,m){return isFunction(f)||invalidArgument("Future.fork",0,"be a function",f),1===arguments.length?partial1(fork$f,f):2===arguments.length?fork$f(f,g):fork$f(f,g,m)}function promise(m){return isFuture(m)||invalidFuture("Future.promise",0,m),m.promise()}function value$cont(cont,m){return isFuture(m)||invalidFuture("Future.value",1,m),m.value(cont)}function value(cont,m){return isFunction(cont)||invalidArgument("Future.value",0,"be a Function",cont),1===arguments.length?partial1(value$cont,cont):value$cont(cont,m)}function extractLeft(m){return isFuture(m)||invalidFuture("Future.extractLeft",0,m),m.extractLeft()}function extractRight(m){return isFuture(m)||invalidFuture("Future.extractRight",0,m),m.extractRight()}function After$race(other){return other.isSettled()?other:isNever(other)?this:other instanceof After||other instanceof RejectAfter?other._time<this._time?other:this:Core._race.call(this,other)}function After(time,value){this._time=time,this._value=value}function RejectAfter(time,value){this._time=time,this._value=value}function after$time(time,value){return time===1/0?never:new After(time,value)}function after(time,value){return isUnsigned(time)||invalidArgument("Future.after",0,"be a positive integer",time),1===arguments.length?partial1(after$time,time):after$time(time,value)}function rejectAfter$time(time,reason){return time===1/0?never:new RejectAfter(time,reason)}function rejectAfter(time,reason){return isUnsigned(time)||invalidArgument("Future.rejectAfter",0,"be a positive integer",time),1===arguments.length?partial1(rejectAfter$time,time):rejectAfter$time(time,reason)}function Attempt(fn){this._fn=fn}function attempt(f){return isFunction(f)||invalidArgument("Future.try",0,"be a function",f),new Attempt(f)}function Queued(rej,res){this[Rejected$1]=rej,this[Resolved$1]=res}function Cached(pure){this._pure=pure,this.reset()}function cache(m){return isFuture(m)||invalidFuture("Future.cache",0,m),new Cached(m)}function ChainRec(step,init){this._step=step,this._init=init}function chainRec(step,init){return new ChainRec(step,init)}function Encase(fn,a){this._fn=fn,this._a=a}function encase(f,x){return isFunction(f)||invalidArgument("Future.encase",0,"be a function",f),1===arguments.length?partial1(encase,f):new Encase(f,x)}function Encase2(fn,a,b){this._fn=fn,this._a=a,this._b=b}function encase2(f,x,y){switch(isFunction(f)||invalidArgument("Future.encase2",0,"be a function",f),arguments.length){case 1:return partial1(encase2,f);case 2:return partial2(encase2,f,x);default:return new Encase2(f,x,y)}}function Encase3(fn,a,b,c){this._fn=fn,this._a=a,this._b=b,this._c=c}function encase3(f,x,y,z){switch(isFunction(f)||invalidArgument("Future.encase3",0,"be a function",f),arguments.length){case 1:return partial1(encase3,f);case 2:return partial2(encase3,f,x);case 3:return partial3(encase3,f,x,y);default:return new Encase3(f,x,y,z)}}function EncaseN(fn,a){this._fn=fn,this._a=a}function encaseN(f,x){return isFunction(f)||invalidArgument("Future.encaseN",0,"be a function",f),1===arguments.length?partial1(encaseN,f):new EncaseN(f,x)}function EncaseN2(fn,a,b){this._fn=fn,this._a=a,this._b=b}function encaseN2(f,x,y){switch(isFunction(f)||invalidArgument("Future.encaseN2",0,"be a function",f),arguments.length){case 1:return partial1(encaseN2,f);case 2:return partial2(encaseN2,f,x);default:return new EncaseN2(f,x,y)}}function EncaseN$1(fn,a,b,c){this._fn=fn,this._a=a,this._b=b,this._c=c}function encaseN3(f,x,y,z){switch(isFunction(f)||invalidArgument("Future.encaseN3",0,"be a function",f),arguments.length){case 1:return partial1(encaseN3,f);case 2:return partial2(encaseN3,f,x);case 3:return partial3(encaseN3,f,x,y);default:return new EncaseN$1(f,x,y,z)}}function check$promise(p,f,a){return isThenable(p)?p:typeError("Future.encaseP expects the function its given to return a Promise/Thenable\n Actual: "+show(p)+"\n From calling: "+showf(f)+"\n With: "+show(a))}function EncaseP(fn,a){this._fn=fn,this._a=a}function encaseP(f,x){return isFunction(f)||invalidArgument("Future.encaseP",0,"be a function",f),1===arguments.length?partial1(encaseP,f):new EncaseP(f,x)}function check$promise$1(p,f,a,b){return isThenable(p)?p:typeError("Future.encaseP2 expects the function its given to return a Promise/Thenable\n Actual: "+show(p)+"\n From calling: "+showf(f)+"\n With 1: "+show(a)+"\n With 2: "+show(b))}function EncaseP2(fn,a,b){this._fn=fn,this._a=a,this._b=b}function encaseP2(f,x,y){switch(isFunction(f)||invalidArgument("Future.encaseP2",0,"be a function",f),arguments.length){case 1:return partial1(encaseP2,f);case 2:return partial2(encaseP2,f,x);default:return new EncaseP2(f,x,y)}}function check$promise$2(p,f,a,b,c){return isThenable(p)?p:typeError("Future.encaseP3 expects the function its given to return a Promise/Thenable\n Actual: "+show(p)+"\n From calling: "+showf(f)+"\n With 1: "+show(a)+"\n With 2: "+show(b)+"\n With 3: "+show(c))}function EncaseP3(fn,a,b,c){this._fn=fn,this._a=a,this._b=b,this._c=c}function encaseP3(f,x,y,z){switch(isFunction(f)||invalidArgument("Future.encaseP3",0,"be a function",f),arguments.length){case 1:return partial1(encaseP3,f);case 2:return partial2(encaseP3,f,x);case 3:return partial3(encaseP3,f,x,y);default:return new EncaseP3(f,x,y,z)}}function Go(generator){this._generator=generator}function go(generator){return isFunction(generator)||invalidArgument("Future.do",0,"be a Function",generator),new Go(generator)}function check$dispose(m,f,x){isFuture(m)||invalidFuture("Future.hook","the first function its given to return a Future",m,"\n From calling: "+showf(f)+"\n With: "+show(x))}function check$consume(m,f,x){isFuture(m)||invalidFuture("Future.hook","the second function its given to return a Future",m,"\n From calling: "+showf(f)+"\n With: "+show(x))}function Hook(acquire,dispose,consume){this._acquire=acquire,this._dispose=dispose,this._consume=consume}function hook$acquire$cleanup(acquire,cleanup,consume){return isFunction(consume)||invalidArgument("Future.hook",2,"be a Future",consume),new Hook(acquire,cleanup,consume)}function hook$acquire(acquire,cleanup,consume){return isFunction(cleanup)||invalidArgument("Future.hook",1,"be a function",cleanup),2===arguments.length?partial2(hook$acquire$cleanup,acquire,cleanup):hook$acquire$cleanup(acquire,cleanup,consume)}function hook(acquire,cleanup,consume){return isFuture(acquire)||invalidFuture("Future.hook",0,acquire),1===arguments.length?partial1(hook$acquire,acquire):2===arguments.length?hook$acquire(acquire,cleanup):hook$acquire(acquire,cleanup,consume)}function Node(fn){this._fn=fn}function node(f){return isFunction(f)||invalidArgument("Future.node",0,"be a function",f),new Node(f)}function check$ap$f(f){isFunction(f)||typeError("Future#ap expects its first argument to be a Future of a Function\n Actual: Future.of("+show(f)+")")}function ParallelAp(mval,mfunc){this._mval=mval,this._mfunc=mfunc}function isParallel(x){return x instanceof Par||type(x)===Par["@@type"]}function seq(par){return isParallel(par)||invalidArgument("Future.seq",0,"to be a Par",par),par.sequential}function Parallel(max,futures){this._futures=futures,this._length=futures.length,this._max=Math.min(this._length,max)}function parallel$max(max,xs){isArray(xs)||invalidArgument("Future.parallel",1,"be an array",xs);var futures=mapArray(xs,check$parallel);return 0===futures.length?emptyArray:new Parallel(max,futures)}function parallel(max,xs){return isUnsigned(max)||invalidArgument("Future.parallel",0,"be a positive integer",max),1===arguments.length?partial1(parallel$max,max):parallel$max(max,xs)}function check$promise$3(p,f){return isThenable(p)?p:typeError("Future.tryP expects the function its given to return a Promise/Thenable\n Actual: "+show(p)+"\n From calling: "+showf(f))}function TryP(fn){this._fn=fn}function tryP(f){return isFunction(f)||invalidArgument("Future.tryP",0,"be a function",f),new TryP(f)}Denque="default"in Denque?Denque.default:Denque,Z="default"in Z?Z.default:Z,inspectf="default"in inspectf?inspectf.default:inspectf,type="default"in type?type.default:type,concurrify="default"in concurrify?concurrify.default:concurrify;var noop=function(){},moop=function(){return this},show=Z.toString,padf=function(sf,s){return s.replace(/^/gm,sf).replace(sf,"")},showf=function(f){return padf(" ",inspectf(2,f))},mapArray=function(xs,f){for(var l=xs.length,ys=new Array(l),i=0;i<l;i++)ys[i]=f(xs[i],i,xs);return ys},partial1=function(f,a){return function(b,c,d){switch(arguments.length){case 1:return f(a,b);case 2:return f(a,b,c);default:return f(a,b,c,d)}}},partial2=function(f,a,b){return function(c,d){return 1===arguments.length?f(a,b,c):f(a,b,c,d)}},partial3=function(f,a,b,c){return function(d){return f(a,b,c,d)}},escapeTick=function(f){return function(x){setTimeout(function(){f(x)},0)}},isFunction=function(f){return"function"==typeof f},isThenable=function(m){return m instanceof Promise||Boolean(m)&&isFunction(m.then)},isBoolean=function(f){return"boolean"==typeof f},isNumber=function(f){return"number"==typeof f},isUnsigned=function(n){return n===1/0||isNumber(n)&&n>0&&n%1==0},isObject=function(o){return null!==o&&"object"==typeof o},isIterator=function(i){return isObject(i)&&isFunction(i.next)},isArray=Array.isArray,FL={map:"fantasy-land/map",bimap:"fantasy-land/bimap",chain:"fantasy-land/chain",chainRec:"fantasy-land/chainRec",ap:"fantasy-land/ap",of:"fantasy-land/of"},ordinal=["first","second","third","fourth","fifth"],$$type="fluture/Future@2",error=function(message){throw new Error(message)},typeError=function(message){throw new TypeError(message)},invalidArgument=function(it,at,expected,actual){return typeError(it+" expects its "+ordinal[at]+" argument to "+expected+"\n Actual: "+show(actual))},invalidContext=function(it,actual){return typeError(it+" was invoked outside the context of a Future. You might want to use a dispatcher instead\n Called on: "+show(actual))},invalidNamespace=function(m,x){return"The Future was not created by fluture. Make sure you transform other Futures to fluture Futures. Got "+(x?"a Future from "+x:"an unscoped Future")+".\n See: https://github.com/fluture-js/Fluture#casting-futures"},invalidVersion=function(m,x){return"The Future was created by "+(x<2?"an older":"a newer")+" version of fluture. This means that one of the sources which creates Futures is outdated. Update this source, or transform its created Futures to be compatible.\n See: https://github.com/fluture-js/Fluture#casting-futures"},invalidFuture=function(it,at,m,s){void 0===s&&(s="");var id=type.parse(type(m)),info="Future"===id.name?"\n"+("fluture"!==id.namespace?invalidNamespace(0,id.namespace):2!==id.version?invalidVersion(0,id.version):"Nothing seems wrong. Contact the Fluture maintainers."):"";typeError(it+" expects "+(ordinal[at]?"its "+ordinal[at]+" argument to be a valid Future":at)+"."+info+"\n Actual: "+show(m)+" :: "+id.name+s)},throwRejection=function(x){return error("Future#value was called on a rejected Future\n Actual: Future.reject("+show(x)+")")};Future.prototype[FL.ap]=function(other){return other._ap(this)},Future.prototype[FL.map]=function(mapper){return this._map(mapper)},Future.prototype[FL.bimap]=function(lmapper,rmapper){return this._bimap(lmapper,rmapper)},Future.prototype[FL.chain]=function(mapper){return this._chain(mapper)},Future.prototype.ap=function(other){return isFuture(this)||invalidContext("Future#ap",this),isFuture(other)||invalidFuture("Future#ap",0,other),this._ap(other)},Future.prototype.map=function(mapper){return isFuture(this)||invalidContext("Future#map",this),isFunction(mapper)||invalidArgument("Future#map",0,"to be a Function",mapper),this._map(mapper)},Future.prototype.bimap=function(lmapper,rmapper){return isFuture(this)||invalidContext("Future#bimap",this),isFunction(lmapper)||invalidArgument("Future#bimap",0,"to be a Function",lmapper),isFunction(rmapper)||invalidArgument("Future#bimap",1,"to be a Function",rmapper),this._bimap(lmapper,rmapper)},Future.prototype.chain=function(mapper){return isFuture(this)||invalidContext("Future#chain",this),isFunction(mapper)||invalidArgument("Future#chain",0,"to be a Function",mapper),this._chain(mapper)},Future.prototype.mapRej=function(mapper){return isFuture(this)||invalidContext("Future#mapRej",this),isFunction(mapper)||invalidArgument("Future#mapRej",0,"to be a Function",mapper),this._mapRej(mapper)},Future.prototype.chainRej=function(mapper){return isFuture(this)||invalidContext("Future#chainRej",this),isFunction(mapper)||invalidArgument("Future#chainRej",0,"to be a Function",mapper),this._chainRej(mapper)},Future.prototype.race=function(other){return isFuture(this)||invalidContext("Future#race",this),isFuture(other)||invalidFuture("Future#race",0,other),this._race(other)},Future.prototype.both=function(other){return isFuture(this)||invalidContext("Future#both",this),isFuture(other)||invalidFuture("Future#both",0,other),this._both(other)},Future.prototype.and=function(other){return isFuture(this)||invalidContext("Future#and",this),isFuture(other)||invalidFuture("Future#and",0,other),this._and(other)},Future.prototype.or=function(other){return isFuture(this)||invalidContext("Future#or",this),isFuture(other)||invalidFuture("Future#or",0,other),this._or(other)},Future.prototype.swap=function(){return isFuture(this)||invalidContext("Future#ap",this),this._swap()},Future.prototype.fold=function(lmapper,rmapper){return isFuture(this)||invalidContext("Future#ap",this),isFunction(lmapper)||invalidArgument("Future#fold",0,"to be a Function",lmapper),isFunction(rmapper)||invalidArgument("Future#fold",1,"to be a Function",rmapper),this._fold(lmapper,rmapper)},Future.prototype.finally=function(other){return isFuture(this)||invalidContext("Future#finally",this),isFuture(other)||invalidFuture("Future#finally",0,other),this._finally(other)},Future.prototype.lastly=function(other){return isFuture(this)||invalidContext("Future#lastly",this),isFuture(other)||invalidFuture("Future#lastly",0,other),this._finally(other)},Future.prototype.fork=function(rej,res){return isFuture(this)||invalidContext("Future#fork",this),isFunction(rej)||invalidArgument("Future#fork",0,"to be a Function",rej),isFunction(res)||invalidArgument("Future#fork",0,"to be a Function",res),this._fork(rej,res)},Future.prototype.value=function(res){return isFuture(this)||invalidContext("Future#value",this),isFunction(res)||invalidArgument("Future#value",0,"to be a Function",res),this._fork(throwRejection,res)},Future.prototype.promise=function(){var this$1=this;return new Promise(function(res,rej){return this$1._fork(rej,res)})},Future.prototype.isRejected=function(){return!1},Future.prototype.isResolved=function(){return!1},Future.prototype.isSettled=function(){return this.isRejected()||this.isResolved()},Future.prototype.extractLeft=function(){return[]},Future.prototype.extractRight=function(){return[]};var Core=Object.create(Future.prototype);Core._ap=function(other){return new Sequence(this,[new ApAction(other)])},Core._map=function(mapper){return new Sequence(this,[new MapAction(mapper)])},Core._bimap=function(lmapper,rmapper){return new Sequence(this,[new BimapAction(lmapper,rmapper)])},Core._chain=function(mapper){return new Sequence(this,[new ChainAction(mapper)])},Core._mapRej=function(mapper){return new Sequence(this,[new MapRejAction(mapper)])},Core._chainRej=function(mapper){return new Sequence(this,[new ChainRejAction(mapper)])},Core._race=function(other){return new Sequence(this,[new RaceAction(other)])},Core._both=function(other){return new Sequence(this,[new BothAction(other)])},Core._and=function(other){return new Sequence(this,[new AndAction(other)])},Core._or=function(other){return new Sequence(this,[new OrAction(other)])},Core._swap=function(){return new Sequence(this,[new SwapAction])},Core._fold=function(lmapper,rmapper){return new Sequence(this,[new FoldAction(lmapper,rmapper)])},Core._finally=function(other){return new Sequence(this,[new FinallyAction(other)])},Computation.prototype=Object.create(Core),Computation.prototype._fork=function(rej,res){var open=!0,f=this._computation(function(x){open&&(open=!1,rej(x))},function(x){open&&(open=!1,res(x))});return check$fork(f,this._computation),function(){open&&f&&f(),open=!1}},Computation.prototype.toString=function(){return"Future("+showf(this._computation)+")"},Rejected.prototype=Object.create(Core),Rejected.prototype._ap=moop,Rejected.prototype._map=moop,Rejected.prototype._chain=moop,Rejected.prototype._race=moop,Rejected.prototype._both=moop,Rejected.prototype._and=moop,Rejected.prototype._or=function(other){return other},Rejected.prototype._finally=function(other){return other._and(this)},Rejected.prototype._swap=function(){return new Resolved(this._value)},Rejected.prototype._fork=function(rej){return rej(this._value),noop},Rejected.prototype.isRejected=function(){return!0},Rejected.prototype.extractLeft=function(){return[this._value]},Rejected.prototype.toString=function(){return"Future.reject("+show(this._value)+")"};var reject=function(x){return new Rejected(x)};Resolved.prototype=Object.create(Core),Resolved.prototype._race=moop,Resolved.prototype._mapRej=moop,Resolved.prototype._or=moop,Resolved.prototype._and=function(other){return other},Resolved.prototype._both=function(other){var this$1=this;return other._map(function(x){return[this$1._value,x]})},Resolved.prototype._swap=function(){return new Rejected(this._value)},Resolved.prototype._finally=function(other){var this$1=this;return other._map(function(){return this$1._value})},Resolved.prototype._fork=function(rej,res){return res(this._value),noop},Resolved.prototype.isResolved=function(){return!0},Resolved.prototype.extractRight=function(){return[this._value]},Resolved.prototype.toString=function(){return"Future.of("+show(this._value)+")"};var of=function(x){return new Resolved(x)};Never.prototype=Object.create(Future.prototype),Never.prototype._ap=moop,Never.prototype._map=moop,Never.prototype._bimap=moop,Never.prototype._chain=moop,Never.prototype._mapRej=moop,Never.prototype._chainRej=moop,Never.prototype._both=moop,Never.prototype._or=moop,Never.prototype._swap=moop,Never.prototype._fold=moop,Never.prototype._finally=moop,Never.prototype._race=function(other){return other},Never.prototype._fork=function(){return noop},Never.prototype.toString=function(){return"Future.never"};var never=new Never,isNever=function(x){return x===never};Eager.prototype=Object.create(Core),Eager.prototype._fork=function(rej,res){return this.rejected?rej(this.value):this.resolved?res(this.value):(this.rej=rej,this.res=res),this.cancel};var Action=function(){};Action.prototype.rejected=function(x){return new Rejected(x)},Action.prototype.resolved=function(x){return new Resolved(x)},Action.prototype.run=function(){return this},Action.prototype.cancel=function(){};var check$ap=function(f){return isFunction(f)?f:typeError("Future#ap expects its first argument to be a Future of a Function\n Actual: Future.of("+show(f)+")")},ApAction=function(Action){function ApAction(other){Action.call(this),this.other=other}return Action&&(ApAction.__proto__=Action),ApAction.prototype=Object.create(Action&&Action.prototype),ApAction.prototype.constructor=ApAction,ApAction.prototype.resolved=function(f){return check$ap(f),this.other._map(function(x){return f(x)})},ApAction.prototype.toString=function(){return"ap("+this.other.toString()+")"},ApAction}(Action),MapAction=function(Action){function MapAction(mapper){Action.call(this),this.mapper=mapper}return Action&&(MapAction.__proto__=Action),MapAction.prototype=Object.create(Action&&Action.prototype),MapAction.prototype.constructor=MapAction,MapAction.prototype.resolved=function(x){return new Resolved(this.mapper(x))},MapAction.prototype.toString=function(){return"map("+showf(this.mapper)+")"},MapAction}(Action),BimapAction=function(Action){function BimapAction(lmapper,rmapper){Action.call(this),this.lmapper=lmapper,this.rmapper=rmapper}return Action&&(BimapAction.__proto__=Action),BimapAction.prototype=Object.create(Action&&Action.prototype),BimapAction.prototype.constructor=BimapAction,BimapAction.prototype.rejected=function(x){return new Rejected(this.lmapper(x))},BimapAction.prototype.resolved=function(x){return new Resolved(this.rmapper(x))},BimapAction.prototype.toString=function(){return"bimap("+showf(this.lmapper)+", "+showf(this.rmapper)+")"},BimapAction}(Action),check$chain=function(m,f,x){return isFuture(m)?m:invalidFuture("Future#chain","the function its given to return a Future",m,"\n From calling: "+showf(f)+"\n With: "+show(x))},ChainAction=function(Action){function ChainAction(mapper){Action.call(this),this.mapper=mapper}return Action&&(ChainAction.__proto__=Action),ChainAction.prototype=Object.create(Action&&Action.prototype),ChainAction.prototype.constructor=ChainAction,ChainAction.prototype.resolved=function(x){return check$chain(this.mapper(x),this.mapper,x)},ChainAction.prototype.toString=function(){return"chain("+showf(this.mapper)+")"},ChainAction}(Action),MapRejAction=function(Action){function MapRejAction(mapper){Action.call(this),this.mapper=mapper}return Action&&(MapRejAction.__proto__=Action),MapRejAction.prototype=Object.create(Action&&Action.prototype),MapRejAction.prototype.constructor=MapRejAction,MapRejAction.prototype.rejected=function(x){return new Rejected(this.mapper(x))},MapRejAction.prototype.toString=function(){return"mapRej("+showf(this.mapper)+")"},MapRejAction}(Action),check$chainRej=function(m,f,x){return isFuture(m)?m:invalidFuture("Future#chainRej","the function its given to return a Future",m,"\n From calling: "+showf(f)+"\n With: "+show(x))},ChainRejAction=function(Action){function ChainRejAction(mapper){Action.call(this),this.mapper=mapper}return Action&&(ChainRejAction.__proto__=Action),ChainRejAction.prototype=Object.create(Action&&Action.prototype),ChainRejAction.prototype.constructor=ChainRejAction,ChainRejAction.prototype.rejected=function(x){return check$chainRej(this.mapper(x),this.mapper,x)},ChainRejAction.prototype.toString=function(){return"chainRej("+showf(this.mapper)+")"},ChainRejAction}(Action),SwapAction=function(Action){function SwapAction(){return Action.call(this),SwapAction.instance||(SwapAction.instance=this)}return Action&&(SwapAction.__proto__=Action),SwapAction.prototype=Object.create(Action&&Action.prototype),SwapAction.prototype.constructor=SwapAction,SwapAction.prototype.rejected=function(x){return new Resolved(x)},SwapAction.prototype.resolved=function(x){return new Rejected(x)},SwapAction.prototype.toString=function(){return"swap()"},SwapAction}(Action),FoldAction=function(Action){function FoldAction(lmapper,rmapper){Action.call(this),this.lmapper=lmapper,this.rmapper=rmapper}return Action&&(FoldAction.__proto__=Action),FoldAction.prototype=Object.create(Action&&Action.prototype),FoldAction.prototype.constructor=FoldAction,FoldAction.prototype.rejected=function(x){return new Resolved(this.lmapper(x))},FoldAction.prototype.resolved=function(x){return new Resolved(this.rmapper(x))},FoldAction.prototype.toString=function(){return"fold("+showf(this.lmapper)+", "+showf(this.rmapper)+")"},FoldAction}(Action),FinallyAction=function(Action){function FinallyAction(other){Action.call(this),this.other=other}return Action&&(FinallyAction.__proto__=Action),FinallyAction.prototype=Object.create(Action&&Action.prototype),FinallyAction.prototype.constructor=FinallyAction,FinallyAction.prototype.cancel=function(){this.other._fork(noop,noop)()},FinallyAction.prototype.rejected=function(x){return this.other._and(new Rejected(x))},FinallyAction.prototype.resolved=function(x){return this.other._map(function(){return x})},FinallyAction.prototype.toString=function(){return"finally("+this.other.toString()+")"},FinallyAction}(Action),AndAction=function(Action){function AndAction(other){Action.call(this),this.other=other}return Action&&(AndAction.__proto__=Action),AndAction.prototype=Object.create(Action&&Action.prototype),AndAction.prototype.constructor=AndAction,AndAction.prototype.resolved=function(){return this.other},AndAction.prototype.toString=function(){return"and("+this.other.toString()+")"},AndAction}(Action),OrAction=function(Action){function OrAction(other){Action.call(this),this.other=other}return Action&&(OrAction.__proto__=Action),OrAction.prototype=Object.create(Action&&Action.prototype),OrAction.prototype.constructor=OrAction,OrAction.prototype.rejected=function(){return this.other},OrAction.prototype.toString=function(){return"or("+this.other.toString()+")"},OrAction}(Action),RaceAction=function(Action){function RaceAction(other){Action.call(this),this.other=other}return Action&&(RaceAction.__proto__=Action),RaceAction.prototype=Object.create(Action&&Action.prototype),RaceAction.prototype.constructor=RaceAction,RaceAction.prototype.run=function(early){return new RaceActionState(early,this.other)},RaceAction.prototype.toString=function(){return"race("+this.other.toString()+")"},RaceAction}(Action),RaceActionState=function(RaceAction){function RaceActionState(early,other){var this$1=this;RaceAction.call(this,other),this.cancel=other._fork(function(x){return early(new Rejected(x),this$1)},function(x){return early(new Resolved(x),this$1)})}return RaceAction&&(RaceActionState.__proto__=RaceAction),RaceActionState.prototype=Object.create(RaceAction&&RaceAction.prototype),RaceActionState.prototype.constructor=RaceActionState,RaceActionState.prototype.rejected=function(x){return this.cancel(),new Rejected(x)},RaceActionState.prototype.resolved=function(x){return this.cancel(),new Resolved(x)},RaceActionState}(RaceAction),BothAction=function(Action){function BothAction(other){Action.call(this),this.other=other}return Action&&(BothAction.__proto__=Action),BothAction.prototype=Object.create(Action&&Action.prototype),BothAction.prototype.constructor=BothAction,BothAction.prototype.run=function(early){return new BothActionState(early,this.other)},BothAction.prototype.resolved=function(x){return this.other._map(function(y){return[x,y]})},BothAction.prototype.toString=function(){return"both("+this.other.toString()+")"},BothAction}(Action),BothActionState=function(BothAction){
function BothActionState(early,other){var this$1=this;BothAction.call(this,new Eager(other)),this.cancel=this.other.fork(function(x){return early(new Rejected(x),this$1)},noop)}return BothAction&&(BothActionState.__proto__=BothAction),BothActionState.prototype=Object.create(BothAction&&BothAction.prototype),BothActionState.prototype.constructor=BothActionState,BothActionState}(BothAction);Sequence.prototype=Object.create(Future.prototype),Sequence.prototype._transform=function(action){return new Sequence(this._spawn,this._actions.concat([action]))},Sequence.prototype._ap=function(other){return this._transform(new ApAction(other))},Sequence.prototype._map=function(mapper){return this._transform(new MapAction(mapper))},Sequence.prototype._bimap=function(lmapper,rmapper){return this._transform(new BimapAction(lmapper,rmapper))},Sequence.prototype._chain=function(mapper){return this._transform(new ChainAction(mapper))},Sequence.prototype._mapRej=function(mapper){return this._transform(new MapRejAction(mapper))},Sequence.prototype._chainRej=function(mapper){return this._transform(new ChainRejAction(mapper))},Sequence.prototype._race=function(other){return isNever(other)?this:this._transform(new RaceAction(other))},Sequence.prototype._both=function(other){return this._transform(new BothAction(other))},Sequence.prototype._and=function(other){return this._transform(new AndAction(other))},Sequence.prototype._or=function(other){return this._transform(new OrAction(other))},Sequence.prototype._swap=function(){return this._transform(new SwapAction)},Sequence.prototype._fold=function(lmapper,rmapper){return this._transform(new FoldAction(lmapper,rmapper))},Sequence.prototype._finally=function(other){return this._transform(new FinallyAction(other))},Sequence.prototype._fork=function(rej,res){function settle(m){if(settled=!0,(future=m)instanceof Sequence){for(var i=future._actions.length-1;i>=0;i--)stack.unshift(future._actions[i]);future=future._spawn}}function early(m,terminator){if(cancel(),action!==terminator)for(action.cancel();(it=queue.shift())&&it!==terminator;)it.cancel();settle(m),async&&drain()}function rejected(x){settle(action.rejected(x)),async&&drain()}function resolved(x){settle(action.resolved(x)),async&&drain()}function drain(){for(async=!1;action=stack.shift()||queue.shift();)if(settled=!1,cancel=future._fork(rejected,resolved),!settled&&(action=action.run(early),!settled)){for(;it=stack.shift();){var tmp=it.run(early);if(settled)break;queue.push(tmp)}if(!settled)return void(async=!0)}cancel=future._fork(rej,res)}var action,it,settled,async,stack=new Denque(this._actions),queue=new Denque(this._actions.length),cancel=noop,future=this._spawn;return drain(),function(){for(cancel(),action&&action.cancel();it=queue.shift();)it.cancel();stack.clear(),cancel=noop}},Sequence.prototype.toString=function(){return""+this._spawn.toString()+this._actions.map(function(x){return"."+x.toString()}).join("")},Future["@@type"]=$$type,Future[FL.of]=of;var dispatchers=Object.freeze({ap:ap,map:map,bimap:bimap,chain:chain,mapRej:mapRej,chainRej:chainRej,lastly:lastly,finally:lastly,and:and,both:both,or:or,race:race,swap:swap,fold:fold,fork:fork,promise:promise,value:value,extractLeft:extractLeft,extractRight:extractRight});After.prototype=Object.create(Core),After.prototype._race=After$race,After.prototype._swap=function(){return new RejectAfter(this._time,this._value)},After.prototype._fork=function(rej,res){var id=setTimeout(res,this._time,this._value);return function(){clearTimeout(id)}},After.prototype.extractRight=function(){return[this._value]},After.prototype.toString=function(){return"Future.after("+show(this._time)+", "+show(this._value)+")"},RejectAfter.prototype=Object.create(Core),RejectAfter.prototype._race=After$race,RejectAfter.prototype._swap=function(){return new After(this._time,this._value)},RejectAfter.prototype._fork=function(rej){var id=setTimeout(rej,this._time,this._value);return function(){clearTimeout(id)}},RejectAfter.prototype.extractLeft=function(){return[this._value]},RejectAfter.prototype.toString=function(){return"Future.rejectAfter("+show(this._time)+", "+show(this._value)+")"},Attempt.prototype=Object.create(Core),Attempt.prototype._fork=function(rej,res){var r;try{r=this._fn()}catch(e){return rej(e),noop}return res(r),noop},Attempt.prototype.toString=function(){return"Future.try("+showf(this._fn)+")"};var Cold=Cached.Cold=0,Pending=Cached.Pending=1,Rejected$1=Cached.Rejected=2,Resolved$1=Cached.Resolved=3;Cached.prototype=Object.create(Core),Cached.prototype.isRejected=function(){return this._state===Rejected$1},Cached.prototype.isResolved=function(){return this._state===Resolved$1},Cached.prototype.extractLeft=function(){return this.isRejected()?[this._value]:[]},Cached.prototype.extractRight=function(){return this.isResolved()?[this._value]:[]},Cached.prototype._addToQueue=function(rej,res){var _this=this;if(_this._state>Pending)return noop;var i=_this._queue.push(new Queued(rej,res))-1;return _this._queued=_this._queued+1,function(){_this._state>Pending||(_this._queue[i]=void 0,_this._queued=_this._queued-1,0===_this._queued&&_this.reset())}},Cached.prototype._drainQueue=function(){if(!(this._state<=Pending)&&0!==this._queued){for(var queue=this._queue,length=queue.length,state=this._state,value=this._value,i=0;i<length;i++)queue[i]&&queue[i][state](value),queue[i]=void 0;this._queue=void 0,this._queued=0}},Cached.prototype.reject=function(reason){this._state>Pending||(this._value=reason,this._state=Rejected$1,this._drainQueue())},Cached.prototype.resolve=function(value){this._state>Pending||(this._value=value,this._state=Resolved$1,this._drainQueue())},Cached.prototype.run=function(){var _this=this;_this._state>Cold||(_this._state=Pending,_this._cancel=_this._pure._fork(function(x){_this.reject(x)},function(x){_this.resolve(x)}))},Cached.prototype.reset=function(){this._state!==Cold&&(this._state>Pending&&this._cancel(),this._cancel=noop,this._queue=[],this._queued=0,this._value=void 0,this._state=Cold)},Cached.prototype._fork=function(rej,res){var cancel=noop;switch(this._state){case Pending:cancel=this._addToQueue(rej,res);break;case Rejected$1:rej(this._value);break;case Resolved$1:res(this._value);break;default:cancel=this._addToQueue(rej,res),this.run()}return cancel},Cached.prototype.toString=function(){return"Future.cache("+this._pure.toString()+")"};var Next=function(x){return{done:!1,value:x}},Done=function(x){return{done:!0,value:x}},isIteration=function(x){return isObject(x)&&isBoolean(x.done)},Undetermined=0,Synchronous=1,Asynchronous=2;ChainRec.prototype=Object.create(Core),ChainRec.prototype._fork=function(rej,res){function resolved(it){state=it,timing=timing===Undetermined?Synchronous:drain()}function drain(){for(;!state.done;){timing=Undetermined;var m=_step(Next,Done,state.value);if(cancel=m._fork(rej,resolved),timing!==Synchronous)return void(timing=Asynchronous)}res(state.value)}var ref=this,_step=ref._step,_init=ref._init,timing=Undetermined,cancel=noop,state=Next(_init);return drain(),function(){cancel()}},ChainRec.prototype.toString=function(){return"Future.chainRec("+showf(this._step)+", "+show(this._init)+")"},Future[FL.chainRec]=chainRec,Encase.prototype=Object.create(Core),Encase.prototype._fork=function(rej,res){var r;try{r=this._fn(this._a)}catch(e){return rej(e),noop}return res(r),noop},Encase.prototype.toString=function(){var ref=this,_fn=ref._fn,_a=ref._a;return"Future.encase("+showf(_fn)+", "+show(_a)+")"},Encase2.prototype=Object.create(Core),Encase2.prototype._fork=function(rej,res){var r;try{r=this._fn(this._a,this._b)}catch(e){return rej(e),noop}return res(r),noop},Encase2.prototype.toString=function(){var ref=this,_fn=ref._fn,_a=ref._a,_b=ref._b;return"Future.encase2("+showf(_fn)+", "+show(_a)+", "+show(_b)+")"},Encase3.prototype=Object.create(Core),Encase3.prototype._fork=function(rej,res){var r;try{r=this._fn(this._a,this._b,this._c)}catch(e){return rej(e),noop}return res(r),noop},Encase3.prototype.toString=function(){var ref=this,_fn=ref._fn,_a=ref._a,_b=ref._b,_c=ref._c;return"Future.encase3("+showf(_fn)+", "+show(_a)+", "+show(_b)+", "+show(_c)+")"},EncaseN.prototype=Object.create(Core),EncaseN.prototype._fork=function(rej,res){var open=!0;return this._fn(this._a,function(err,val){open&&(open=!1,err?rej(err):res(val))}),function(){open=!1}},EncaseN.prototype.toString=function(){var ref=this,_fn=ref._fn,_a=ref._a;return"Future.encaseN("+showf(_fn)+", "+show(_a)+")"},EncaseN2.prototype=Object.create(Core),EncaseN2.prototype._fork=function(rej,res){var open=!0;return this._fn(this._a,this._b,function(err,val){open&&(open=!1,err?rej(err):res(val))}),function(){open=!1}},EncaseN2.prototype.toString=function(){var ref=this,_fn=ref._fn,_a=ref._a,_b=ref._b;return"Future.encaseN2("+showf(_fn)+", "+show(_a)+", "+show(_b)+")"},EncaseN$1.prototype=Object.create(Core),EncaseN$1.prototype._fork=function(rej,res){var open=!0;return this._fn(this._a,this._b,this._c,function(err,val){open&&(open=!1,err?rej(err):res(val))}),function(){open=!1}},EncaseN$1.prototype.toString=function(){var ref=this,_fn=ref._fn,_a=ref._a,_b=ref._b,_c=ref._c;return"Future.encaseN3("+showf(_fn)+", "+show(_a)+", "+show(_b)+", "+show(_c)+")"},EncaseP.prototype=Object.create(Core),EncaseP.prototype._fork=function(rej,res){var ref=this,_fn=ref._fn,_a=ref._a;return check$promise(_fn(_a),_fn,_a).then(escapeTick(res),escapeTick(rej)),noop},EncaseP.prototype.toString=function(){var ref=this,_fn=ref._fn,_a=ref._a;return"Future.encaseP("+showf(_fn)+", "+show(_a)+")"},EncaseP2.prototype=Object.create(Core),EncaseP2.prototype._fork=function(rej,res){var ref=this,_fn=ref._fn,_a=ref._a,_b=ref._b;return check$promise$1(_fn(_a,_b),_fn,_a,_b).then(escapeTick(res),escapeTick(rej)),noop},EncaseP2.prototype.toString=function(){var ref=this,_fn=ref._fn,_a=ref._a,_b=ref._b;return"Future.encaseP2("+showf(_fn)+", "+show(_a)+", "+show(_b)+")"},EncaseP3.prototype=Object.create(Core),EncaseP3.prototype._fork=function(rej,res){var ref=this,_fn=ref._fn,_a=ref._a,_b=ref._b,_c=ref._c;return check$promise$2(_fn(_a,_b,_c),_fn,_a,_b,_c).then(escapeTick(res),escapeTick(rej)),noop},EncaseP3.prototype.toString=function(){var ref=this,_fn=ref._fn,_a=ref._a,_b=ref._b,_c=ref._c;return"Future.encaseP3("+show(_fn)+", "+show(_a)+", "+show(_b)+", "+show(_c)+")"};var check$iterator=function(g){return isIterator(g)?g:invalidArgument("Future.do",0,'return an iterator, maybe you forgot the "*"',g)},check$iteration=function(o){return isIteration(o)||typeError("Future.do was given an invalid generator: Its iterator did not return a valid iteration from iterator.next()\n Actual: "+show(o)),o.done||isFuture(o.value)?o:invalidFuture("Future.do","the iterator to produce only valid Futures",o.value,"\n Tip: If you're using a generator, make sure you always yield a Future")};Go.prototype=Object.create(Core),Go.prototype._fork=function(rej,res){function resolved(x){if(value=x,timing===Asynchronous)return drain();timing=Synchronous,state=check$iteration(iterator.next(value))}function drain(){for(state=check$iteration(iterator.next(value));!state.done;)if(timing=Undetermined,cancel=state.value._fork(rej,resolved),timing!==Synchronous)return void(timing=Asynchronous);res(state.value)}var state,value,iterator=check$iterator(this._generator()),timing=Undetermined,cancel=noop;return drain(),function(){cancel()}},Go.prototype.toString=function(){return"Future.do("+showf(this._generator)+")"},Hook.prototype=Object.create(Core),Hook.prototype._fork=function(rej,res){function Hook$done(){cont(value)}function Hook$dispose(){var disposal=_dispose(resource);return check$dispose(disposal,_dispose,resource),cancel=disposal._fork(rej,Hook$done)}function Hook$cancelConsuption(){cancelConsume(),Hook$dispose()()}function Hook$consumptionRejected(x){cont=rej,value=x,Hook$dispose()}function Hook$consumptionResolved(x){cont=res,value=x,Hook$dispose()}function Hook$acquireResolved(x){resource=x;var consumption=_consume(resource);check$consume(consumption,_consume,resource),cancel=Hook$cancelConsuption,cancelConsume=consumption._fork(Hook$consumptionRejected,Hook$consumptionResolved)}var cancel,resource,value,ref=this,_acquire=ref._acquire,_dispose=ref._dispose,_consume=ref._consume,cancelAcquire=noop,cancelConsume=noop,cont=noop;return cancelAcquire=_acquire._fork(rej,Hook$acquireResolved),cancel=cancel||cancelAcquire,function(){cancel()}},Hook.prototype.toString=function(){var ref=this,_acquire=ref._acquire,_dispose=ref._dispose,_consume=ref._consume;return"Future.hook("+_acquire.toString()+", "+showf(_dispose)+", "+showf(_consume)+")"},Node.prototype=Object.create(Core),Node.prototype._fork=function(rej,res){var open=!0;return this._fn(function(err,val){open&&(open=!1,err?rej(err):res(val))}),function(){open=!1}},Node.prototype.toString=function(){var ref=this,_fn=ref._fn;return"Future.node("+showf(_fn)+")"},ParallelAp.prototype=Object.create(Core),ParallelAp.prototype._fork=function(rej,res){function ParallelAp$rej(x){rejected||(rejected=!0,rej(x))}var func,val,c1,c2,okval=!1,okfunc=!1,rejected=!1;return c1=this._mval._fork(ParallelAp$rej,function(x){if(c1=noop,!okval)return okfunc=!0,void(val=x);res(func(x))}),c2=this._mfunc._fork(ParallelAp$rej,function(f){if(c2=noop,check$ap$f(f),!okfunc)return okval=!0,void(func=f);res(f(val))}),function(){c1(),c2()}},ParallelAp.prototype.toString=function(){return"new ParallelAp("+this._mval.toString()+", "+this._mfunc.toString()+")"};var Par=concurrify(Future,never,race,function(mval,mfunc){return new ParallelAp(mval,mfunc)}),check$parallel=function(m,i){return isFuture(m)?m:invalidFuture("Future.parallel","its second argument to be an array of valid Futures. The value at position "+i+" in the array is not a Future",m)};Parallel.prototype=Object.create(Core),Parallel.prototype._fork=function(rej,res){function Parallel$fork$cancelAll(){for(var n=0;n<_max;n++)cancels[n]&&cancels[n]()}function Parallel$fork$rej(reason){Parallel$fork$cancelAll(),rej(reason)}function Parallel$fork$run(future,idx,cancelSlot){cancels[cancelSlot]=future._fork(Parallel$fork$rej,function(value){out[idx]=value,i<_length?Parallel$fork$run(_futures[i],i++,cancelSlot):++i-_max===_length&&res(out)})}for(var ref=this,_futures=ref._futures,_length=ref._length,_max=ref._max,cancels=new Array(_max),out=new Array(_length),i=_max,n=0;n<_max;n++)Parallel$fork$run(_futures[n],n,n);return Parallel$fork$cancelAll},Parallel.prototype.toString=function(){return"Future.parallel("+this._max+", "+show(this._futures)+")"};var emptyArray=new Resolved([]);return TryP.prototype=Object.create(Core),TryP.prototype._fork=function(rej,res){var ref=this,_fn=ref._fn;return check$promise$3(_fn(),_fn).then(escapeTick(res),escapeTick(rej)),noop},TryP.prototype.toString=function(){var ref=this,_fn=ref._fn;return"Future.tryP("+show(_fn)+")"},"function"!=typeof Object.create&&error("Please polyfill Object.create to use Fluture"),"function"!=typeof Object.assign&&error("Please polyfill Object.assign to use Fluture"),"function"!=typeof Array.isArray&&error("Please polyfill Array.isArray to use Fluture"),Object.assign(Future,dispatchers,{Future:Future,after:after,attempt:attempt,cache:cache,chainRec:chainRec,do:go,encase:encase,encase2:encase2,encase3:encase3,encaseN:encaseN,encaseN2:encaseN2,encaseN3:encaseN3,encaseP:encaseP,encaseP2:encaseP2,encaseP3:encaseP3,go:go,hook:hook,isFuture:isFuture,isNever:isNever,never:never,node:node,of:of,Par:Par,parallel:parallel,reject:reject,rejectAfter:rejectAfter,seq:seq,try:attempt,tryP:tryP})});
{
"name": "fluture",
"version": "6.0.1",
"version": "6.1.0",
"description": "FantasyLand compliant (monadic) alternative to Promises",

@@ -67,3 +67,2 @@ "main": "index.js",

"data.task": "^3.0.0",
"denque": "^1.1.1",
"eslint": "^3.0.1",

@@ -78,3 +77,3 @@ "eslint-config-warp": "^1.2.0",

"markdown-toc": "^1.0.2",
"mocha": "^3.0.2",
"mocha": "^3.4.1",
"ramda": "^0.23.0",

@@ -81,0 +80,0 @@ "ramda-fantasy": "^0.8.0",

@@ -21,3 +21,3 @@ # [![Fluture](logo.png)](#butterfly)

* [Stack safe composition and recursion](#stack-safety).
* Great integration with functional libraries such as [Sanctuary][S].
* [Integration](#sanctuary) with [Sanctuary][S].
* A pleasant debugging experience through informative error messages.

@@ -82,2 +82,4 @@

1. [Type signatures](#type-signatures)
* [Types](#types)
* [Type classes](#type-classes)
1. [Stack safety](#stack-safety)

@@ -93,5 +95,7 @@ 1. [Creating Futures](#creating-futures)

* [try](#try)
* [tryP](#tryp)
* [node](#node)
* [encase](#encase)
* [encaseP](#encasep)
* [node](#node)
* [encaseN](#encasen)
1. [Transforming Futures](#transforming-futures)

@@ -126,3 +130,2 @@ * [map](#map)

1. [Sanctuary](#sanctuary)
1. [Futurization](#futurization)
1. [Casting Futures](#casting-futures)

@@ -146,24 +149,35 @@ - [Butterfly](#butterfly)

[Hindley-Milner][2] type signatures are used to document functions. Signatures
starting with a `.` refer to "static" functions, whereas signatures starting
with a `#` refer to functions on the prototype.
[Hindley-Milner][Guide:HM] type signatures are used to document functions, with
one addition: In order to document *methods* as well as static functions, we
prefix every signature with `.` or `#`. This indicates whether the function
lives on the object (`.function`), or its prototype (`#method`). We use `~>` to
separate the implicit `this` argument from the other, explicit, arguments.
A list of all types used within the signatures follows:
#### Types
- **Future** - Instances of Future provided by Fluture.
You'll find that some signatures refer to concrete types, such as `Future`.
This is reference of the types used throughout the documentation:
- **Future** - Instances of Future provided by [compatible versions](#casting-futures) of Fluture.
- **ConcurrentFuture** - [Concurrified][concurrify] Futures ([`Future.Par`](#concurrentfuture)).
- **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].
- **Nodeback a b** - A Node-style callback; A function of signature `(a | Nil, b) -> ()`.
- **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.
- **Done** - A complete (`{done: true}`) Iteration.
- **Cancel** - The nullary cancellation functions returned from computations.
- **Cancel** - The nullary [cancellation](#future) functions returned from computations.
#### Type classes
Some signatures contain "constrained type variables". These constraints are
expressed by means of [type classes][Guide:constraints], specifically those defined by
[Fantasy Land][FL] and verified by [Sanctuary Type Classes][Z]:
- [**Functor**][Z:Functor] - Values which conform to the
[Fantasy Land Functor specification][FL:functor].
- [**Bifunctor**][Z:Bifunctor] - Values which conform to the
[Fantasy Land Bifunctor specification][FL:bifunctor].
- [**Chain**][Z:Chain] - Values which conform to the
[Fantasy Land Chain specification][FL:chain].
- [**Apply**][Z:Apply] - Values which conform to the
[Fantasy Land Apply specification][FL:apply].
### Stack safety

@@ -296,3 +310,3 @@

Takes a function which returns an [Iterator](#type-signatures), commonly a
Takes a function which returns an [Iterator](#types), commonly a
generator-function, and chains every produced Future over the previous.

@@ -342,3 +356,3 @@

Sugar for `Future.encase(f, undefined)`.
Short for [`Future.encase(f, undefined)`](#encase).

@@ -354,2 +368,36 @@ ```js

#### tryP
##### `.tryP :: (() -> Promise e r) -> Future e r`
Create a Future which when forked spawns a Promise using the given function and
resolves with its resolution value, or rejects with its rejection reason.
Short for [`Future.encaseP(f, undefined)`](#encasep).
```js
Future.tryP(() => Promise.resolve('Hello'))
.fork(console.error, console.log);
//> "Hello"
```
#### node
##### `.node :: (Nodeback e r -> ()) -> Future e r`
Creates a Future which rejects with the first argument given to the function,
or resolves with the second if the first is not present.
This is very similar to the [`Future()`-constructor](#future), except that it
takes *a single function* with two arguments instead of *two functions* with a
single argument.
Short for [`Future.encaseN(f, undefined)`](#encasen).
```js
Future.node(done => {
done(null, 'Hello');
})
.fork(console.error, console.log);
//> "Hello"
```
#### encase

@@ -386,3 +434,2 @@ ##### `.encase :: (a -> !e | r) -> a -> Future e r`

#### encaseP
##### `.tryP` :: (a -> Promise e r) -> Future e r
##### `.encaseP :: (a -> Promise e r) -> a -> Future e r`

@@ -411,19 +458,30 @@ ##### `.encaseP2 :: (a, b -> Promise e r) -> a -> b -> Future e r`

#### node
##### `.node :: (((a, b) -> ()) -> ()) -> Future a b`
#### encaseN
##### `.encaseN :: ((a, Nodeback e r) -> ()) -> a -> Future e r`
##### `.encaseN2 :: ((a, b, Nodeback e r) -> ()) -> a -> b -> Future e r`
##### `.encaseN3 :: ((a, b, c, Nodeback e r) -> ()) -> a -> b -> c -> Future e r`
Creates a Future which rejects with the first argument given to the function,
or resolves with the second if the first is not present.
Allows [continuation-passing-style][1] functions to be turned into Future-returning functions.
This is a convenience for NodeJS users who wish to easily obtain a Future from
a node style callback API. To permanently turn a function into one that returns
a Future, check out [futurization](#futurization).
Takes a function which accepts as its last parameter a
[Nodeback](#types), and a value, and returns a Future.
When forked, the Future calls the function with the value and a Nodeback and
resolves the second argument passed to the Nodeback, or or rejects with the
first argument.
```js
const {readFile} = require('fs');
Future.node(done => readFile('package.json', 'utf8', done))
const fs = require('fs');
const read = Future.encaseN2(fs.readFile);
read('README.md', 'utf8')
.map(text => text.split('\n'))
.map(lines => lines[0])
.fork(console.error, console.log);
//> "{...}"
//> "# [![Fluture](logo.png)](#butterfly)"
```
Furthermore; `encaseN2` and `encaseN3` are binary and ternary versions
of `encaseN`, applying two or three arguments to the given function respectively.
### Transforming Futures

@@ -913,5 +971,5 @@

Returns true for [Futures](#type-signatures) and false for everything else. This
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
Returns true for [Futures](#types) and false for everything else. This 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
`instanceof`, unless your intent is to explicitly check for Futures created

@@ -959,24 +1017,22 @@ using the exact `Future` constructor you're testing against.

This happens because Sanctuary Def needs to know about the Future type in order
to determine whether the variable types are consistent.
This happens because Sanctuary Def needs to know about the types created by
Fluture to determine whether the type-variables are consistent.
To let Sanctuary know about Futures, we can provide it a `FutureType` using
[`BinaryType`][$:BinaryType] from Sanctuary Def, and pass it to Sanctuary using
[`S.create`][S:create]:
To let Sanctuary know about these types, we can obtain the type definitions from
[`fluture-sanctuary-types`][FST] and pass them to [`S.create`][S:create]:
```js
const $ = require('sanctuary-def');
const {create, env} = require('sanctuary');
const {Unknown} = require('sanctuary-def');
const {FutureType, ConcurrentFutureType} = require('fluture-sanctuary-types');
const Future = require('fluture');
const {env, create} = require('sanctuary');
const FutureType = $.BinaryType(
Future.name,
'https://github.com/fluture-js/Fluture#future',
Future.isFuture,
Future.extractLeft,
Future.extractRight
);
const S = create({
checkTypes: true,
env: env.concat([
FutureType(Unknown, Unknown),
ConcurrentFutureType(Unknown, Unknown)
])
});
const S = create({checkTypes: true, env: env.concat([FutureType])});
S.I(Future.of(1));

@@ -986,18 +1042,2 @@ //> Future.of(1)

### Futurization
To reduce the boilerplate of making Node or Promise functions return Futures
instead, one might use the [Futurize][1] library:
```js
const Future = require('fluture');
const futurize = require('futurize').futurize(Future);
const readFile = futurize(require('fs').readFile);
readFile('README.md', 'utf8')
.map(text => text.split('\n'))
.map(lines => lines[0])
.fork(console.error, console.log);
//> "# [![Fluture](logo.png)](#butterfly)"
```
### Casting Futures

@@ -1058,3 +1098,5 @@

[STI]: https://github.com/sanctuary-js/sanctuary-type-identifiers
[FST]: https://github.com/fluture-js/fluture-sanctuary-types
[Z]: https://github.com/sanctuary-js/sanctuary-type-classes#readme
[Z:Functor]: https://github.com/sanctuary-js/sanctuary-type-classes#Functor

@@ -1066,3 +1108,2 @@ [Z:Bifunctor]: https://github.com/sanctuary-js/sanctuary-type-classes#Bifunctor

[$]: https://github.com/sanctuary-js/sanctuary-def
[$:BinaryType]: https://github.com/sanctuary-js/sanctuary-def#BinaryType

@@ -1073,4 +1114,6 @@ [concurrify]: https://github.com/fluture-js/concurrify

[1]: https://github.com/futurize/futurize
[2]: https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch7.html
[Guide:HM]: https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch7.html
[Guide:constraints]: https://drboolean.gitbooks.io/mostly-adequate-guide/content/ch7.html#constraints
[1]: https://en.wikipedia.org/wiki/Continuation-passing_style
[3]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterator

@@ -1077,0 +1120,0 @@ [4]: https://github.com/russellmcc/fantasydo

import {Core, isNever, never} from './core';
import {RejectAfter} from './reject-after';
import {show, partial1} from './internal/fn';

@@ -7,10 +6,3 @@ import {isUnsigned} from './internal/is';

export function After(time, value){
this._time = time;
this._value = value;
}
After.prototype = Object.create(Core);
After.prototype._race = function After$race(other){
function After$race(other){
return other.isSettled()

@@ -23,4 +15,13 @@ ? other

: Core._race.call(this, other);
};
}
export function After(time, value){
this._time = time;
this._value = value;
}
After.prototype = Object.create(Core);
After.prototype._race = After$race;
After.prototype._swap = function After$swap(){

@@ -43,10 +44,47 @@ return new RejectAfter(this._time, this._value);

function Future$after$n(n, x){
return n === Infinity ? never : new After(n, x);
export function RejectAfter(time, value){
this._time = time;
this._value = value;
}
export function after(n, x){
if(!isUnsigned(n)) invalidArgument('Future.after', 0, 'be a positive integer', n);
if(arguments.length === 1) return partial1(Future$after$n, n);
return Future$after$n(n, x);
RejectAfter.prototype = Object.create(Core);
RejectAfter.prototype._race = After$race;
RejectAfter.prototype._swap = function RejectAfter$swap(){
return new After(this._time, this._value);
};
RejectAfter.prototype._fork = function RejectAfter$_fork(rej){
const id = setTimeout(rej, this._time, this._value);
return () => { clearTimeout(id) };
};
RejectAfter.prototype.extractLeft = function RejectAfter$extractLeft(){
return [this._value];
};
RejectAfter.prototype.toString = function RejectAfter$toString(){
return `Future.rejectAfter(${show(this._time)}, ${show(this._value)})`;
};
function after$time(time, value){
return time === Infinity ? never : new After(time, value);
}
export function after(time, value){
if(!isUnsigned(time)) invalidArgument('Future.after', 0, 'be a positive integer', time);
if(arguments.length === 1) return partial1(after$time, time);
return after$time(time, value);
}
function rejectAfter$time(time, reason){
return time === Infinity ? never : new RejectAfter(time, reason);
}
export function rejectAfter(time, reason){
if(!isUnsigned(time)) invalidArgument('Future.rejectAfter', 0, 'be a positive integer', time);
if(arguments.length === 1) return partial1(rejectAfter$time, time);
return rejectAfter$time(time, reason);
}

@@ -577,19 +577,11 @@ /*eslint no-param-reassign:0, no-cond-assign:0, no-unmodified-loop-condition:0 */

const actions = new Denque(this._actions);
const runners = new Denque(this._actions.length);
let action, cancel = noop, future = this._spawn, running, settled, async;
const stack = new Denque(this._actions);
const queue = new Denque(this._actions.length);
let action, cancel = noop, future = this._spawn, it, settled, async;
function cancelAll(){
cancel();
action && action.cancel();
while(running = runners.shift()) running.cancel();
actions.clear();
cancel = noop;
}
function absorb(m){
function settle(m){
settled = true;
future = m;
if(!(future instanceof Sequence)) return;
for(let i = future._actions.length - 1; i >= 0; i--) actions.unshift(future._actions[i]);
for(let i = future._actions.length - 1; i >= 0; i--) stack.unshift(future._actions[i]);
future = future._spawn;

@@ -602,5 +594,5 @@ }

action.cancel();
while((running = runners.shift()) && running !== terminator) running.cancel();
while((it = queue.shift()) && it !== terminator) it.cancel();
}
absorb(m);
settle(m);
if(async) drain();

@@ -610,3 +602,3 @@ }

function rejected(x){
absorb(action.rejected(x));
settle(action.rejected(x));
if(async) drain();

@@ -616,3 +608,3 @@ }

function resolved(x){
absorb(action.resolved(x));
settle(action.resolved(x));
if(async) drain();

@@ -622,5 +614,5 @@ }

function drain(){
while(action = actions.shift() || runners.shift()){
async = false;
while(action = stack.shift() || queue.shift()){
settled = false;
async = false;
cancel = future._fork(rejected, resolved);

@@ -630,6 +622,6 @@ if(settled) continue;

if(settled) continue;
while(running = actions.shift()){
const tmp = running.run(early);
while(it = stack.shift()){
const tmp = it.run(early);
if(settled) break;
runners.push(tmp);
queue.push(tmp);
}

@@ -645,3 +637,9 @@ if(settled) continue;

return cancelAll;
return function Sequence$cancel(){
cancel();
action && action.cancel();
while(it = queue.shift()) it.cancel();
stack.clear();
cancel = noop;
};

@@ -648,0 +646,0 @@ };

import {Core} from './core';
import {noop, show, showf, partial1, partial2, partial3} from './internal/fn';
import {noop, show, showf, escapeTick, partial1} from './internal/fn';
import {isThenable, isFunction} from './internal/is';
import {invalidArgument, typeError} from './internal/throw';
function escape(f){
return function imprisoned(x){
setTimeout(function escaped(){ f(x) }, 0);
};
}
function check$promise(p, f, a, b, c){
function check$promise(p, f, a){
return isThenable(p) ? p : typeError(
'Future.encaseP expects the function its given to return a Promise/Thenable'
+ `\n Actual: ${show(p)}\n From calling: ${showf(f)}`
+ `\n With a: ${show(a)}`
+ (arguments.length > 3 ? `\n With b: ${show(b)}` : '')
+ (arguments.length > 4 ? `\n With c: ${show(c)}` : '')
+ `\n With: ${show(a)}`
);
}
function EncaseP$0$fork(rej, res){
const {_fn} = this;
check$promise(_fn(), _fn).then(escape(res), escape(rej));
return noop;
}
function EncaseP$1$fork(rej, res){
const {_fn, _a} = this;
check$promise(_fn(_a), _fn, _a).then(escape(res), escape(rej));
return noop;
}
function EncaseP$2$fork(rej, res){
const {_fn, _a, _b} = this;
check$promise(_fn(_a, _b), _fn, _a, _b).then(escape(res), escape(rej));
return noop;
}
function EncaseP$3$fork(rej, res){
const {_fn, _a, _b, _c} = this;
check$promise(_fn(_a, _b, _c), _fn, _a, _b, _c).then(escape(res), escape(rej));
return noop;
}
const forks = [EncaseP$0$fork, EncaseP$1$fork, EncaseP$2$fork, EncaseP$3$fork];
function EncaseP(fn, a, b, c){
this._length = arguments.length - 1;
export function EncaseP(fn, a){
this._fn = fn;
this._a = a;
this._b = b;
this._c = c;
this._fork = forks[this._length];
}

@@ -59,13 +21,13 @@

EncaseP.prototype._fork = function EncaseP$fork(rej, res){
const {_fn, _a} = this;
check$promise(_fn(_a), _fn, _a).then(escapeTick(res), escapeTick(rej));
return noop;
};
EncaseP.prototype.toString = function EncaseP$toString(){
const args = [this._a, this._b, this._c].slice(0, this._length).map(show).join(', ');
const name = `encaseP${this._length > 1 ? this._length : ''}`;
return `Future.${name}(${show(this._fn)}, ${args})`;
const {_fn, _a} = this;
return `Future.encaseP(${showf(_fn)}, ${show(_a)})`;
};
export function tryP(f){
if(!isFunction(f)) invalidArgument('Future.tryP', 0, 'be a function', f);
return new EncaseP(f);
}
export function encaseP(f, x){

@@ -76,20 +38,1 @@ if(!isFunction(f)) invalidArgument('Future.encaseP', 0, 'be a function', f);

}
export function encaseP2(f, x, y){
if(!isFunction(f)) invalidArgument('Future.encaseP2', 0, 'be a function', f);
switch(arguments.length){
case 1: return partial1(encaseP2, f);
case 2: return partial2(encaseP2, f, x);
default: return new EncaseP(f, x, y);
}
}
export function encaseP3(f, x, y, z){
if(!isFunction(f)) invalidArgument('Future.encaseP3', 0, 'be a function', f);
switch(arguments.length){
case 1: return partial1(encaseP3, f);
case 2: return partial2(encaseP3, f, x);
case 3: return partial3(encaseP3, f, x, y);
default: return new EncaseP(f, x, y, z);
}
}
import {Core} from './core';
import {noop, show, partial1, partial2, partial3} from './internal/fn';
import {noop, show, showf, partial1} from './internal/fn';
import {isFunction} from './internal/is';
import {invalidArgument} from './internal/throw';
function Encase$0$fork(rej, res){
let r;
try{ r = this._fn() }catch(e){ rej(e); return noop }
res(r);
return noop;
export function Encase(fn, a){
this._fn = fn;
this._a = a;
}
function Encase$1$fork(rej, res){
Encase.prototype = Object.create(Core);
Encase.prototype._fork = function Encase$fork(rej, res){
let r;

@@ -18,42 +18,9 @@ try{ r = this._fn(this._a) }catch(e){ rej(e); return noop }

return noop;
}
};
function Encase$2$fork(rej, res){
let r;
try{ r = this._fn(this._a, this._b) }catch(e){ rej(e); return noop }
res(r);
return noop;
}
function Encase$3$fork(rej, res){
let r;
try{ r = this._fn(this._a, this._b, this._c) }catch(e){ rej(e); return noop }
res(r);
return noop;
}
const forks = [Encase$0$fork, Encase$1$fork, Encase$2$fork, Encase$3$fork];
function Encase(fn, a, b, c){
this._length = arguments.length - 1;
this._fn = fn;
this._a = a;
this._b = b;
this._c = c;
this._fork = forks[this._length];
}
Encase.prototype = Object.create(Core);
Encase.prototype.toString = function Encase$toString(){
const args = [this._a, this._b, this._c].slice(0, this._length).map(show).map(x => `, ${x}`);
const name = this._length ? `encase${this._length > 1 ? this._length : ''}` : 'try';
return `Future.${name}(${show(this._fn)}${args.join('')})`;
const {_fn, _a} = this;
return `Future.encase(${showf(_fn)}, ${show(_a)})`;
};
export function attempt(f){
if(!isFunction(f)) invalidArgument('Future.try', 0, 'be a function', f);
return new Encase(f);
}
export function encase(f, x){

@@ -64,20 +31,1 @@ if(!isFunction(f)) invalidArgument('Future.encase', 0, 'be a function', f);

}
export function encase2(f, x, y){
if(!isFunction(f)) invalidArgument('Future.encase2', 0, 'be a function', f);
switch(arguments.length){
case 1: return partial1(encase2, f);
case 2: return partial2(encase2, f, x);
default: return new Encase(f, x, y);
}
}
export function encase3(f, x, y, z){
if(!isFunction(f)) invalidArgument('Future.encase3', 0, 'be a function', f);
switch(arguments.length){
case 1: return partial1(encase3, f);
case 2: return partial2(encase3, f, x);
case 3: return partial3(encase3, f, x, y);
default: return new Encase(f, x, y, z);
}
}
import {
Future,
isFuture,
reject,
isNever,
never,
of,
never,
isNever
reject
} from './core';

@@ -12,7 +12,15 @@

import {after} from './after';
import {after, rejectAfter} from './after';
import {attempt} from './attempt';
import {cache} from './cache';
import {chainRec} from './chain-rec';
import {encase, encase2, encase3, attempt} from './encase';
import {encaseP, encaseP2, encaseP3, tryP} from './encase-p';
import {encase} from './encase';
import {encase2} from './encase2';
import {encase3} from './encase3';
import {encaseN} from './encase-n';
import {encaseN2} from './encase-n2';
import {encaseN3} from './encase-n3';
import {encaseP} from './encase-p';
import {encaseP2} from './encase-p2';
import {encaseP3} from './encase-p3';
import {go} from './go';

@@ -23,3 +31,3 @@ import {hook} from './hook';

import {parallel} from './parallel';
import {rejectAfter} from './reject-after';
import {tryP} from './try-p';

@@ -34,27 +42,30 @@ import {error} from './internal/throw';

Future,
isFuture,
reject,
of,
never,
isNever,
after,
attempt,
cache,
chainRec,
do: go,
encase,
encase2,
encase3,
encaseN,
encaseN2,
encaseN3,
encaseP,
encaseP2,
encaseP3,
tryP,
go,
hook,
isFuture,
isNever,
never,
node,
of,
Par,
seq,
parallel,
reject,
rejectAfter,
chainRec,
encase,
encase2,
encase3,
attempt,
go,
seq,
try: attempt,
do: go
tryP,
});

@@ -31,1 +31,5 @@ import Z from 'sanctuary-type-classes';

};
export const escapeTick = f => function imprisoned(x){
setTimeout(function escaped(){ f(x) }, 0);
};

@@ -6,4 +6,4 @@ import {Core} from './core';

export function Node(computation){
this._computation = computation;
export function Node(fn){
this._fn = fn;
}

@@ -13,15 +13,16 @@

Node.prototype._fork = function Node$_fork(rej, res){
Node.prototype._fork = function Node$fork(rej, res){
let open = true;
this._computation(function Node$fork$done(a, b){
this._fn(function Node$done(err, val){
if(open){
open = false;
a ? rej(a) : res(b);
err ? rej(err) : res(val);
}
});
return function Node$fork$cancel(){ open = false };
return function Node$cancel(){ open = false };
};
Node.prototype.toString = function Node$toString(){
return `Future.node(${showf(this._computation)})`;
const {_fn} = this;
return `Future.node(${showf(_fn)})`;
};

@@ -28,0 +29,0 @@

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