Comparing version 0.0.11 to 0.0.12
@@ -1,3 +0,3 @@ | ||
/*! spica v0.0.11 https://github.com/falsandtru/spica | (c) 2016, falsandtru | undefined License (undefined) */ | ||
define="function"==typeof define&&define.amd?define:function(){"use strict";var e="spica",t={};return function n(r,i,u){return u?void u.apply(this,i.map(function(e){switch(e){case"require":return"function"==typeof require?require:void 0;case"exports":return r.indexOf("/")===-1?t[r]="undefined"==typeof exports?self[r]=self[r]||{}:exports:t[r]=t.hasOwnProperty(r)?t[r]:{};default:return".d"===e.slice(-2)&&{}||t.hasOwnProperty(e)&&t[e]||"function"==typeof require&&require(e)||self[e]}})):void n(e,r,i)}}();var __extends=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)};define("src/lib/concat",["require","exports"],function(e,t){"use strict";function n(e,t){for(var n=0,r=t.length,i=e.length;n<r;++n)e[n+i]=t[n];return e}t.concat=n}),define("src/lib/observable",["require","exports","src/lib/concat"],function(e,t,n){"use strict";var r=function(){function e(){this.node_={parent:void 0,childrenMap:Object.create(null),childrenList:[],registers:[]}}return e.prototype.monitor=function(e,t,n){var r=this;return void 0===n&&(n=t),void this.throwTypeErrorIfInvalidSubscriber_(t,e),void this.seekNode_(e).registers.push([e,n,!0,t]),function(){return r.off(e,n)}},e.prototype.on=function(e,t,n){var r=this;return void 0===n&&(n=t),void this.throwTypeErrorIfInvalidSubscriber_(t,e),void this.seekNode_(e).registers.push([e,n,!1,function(e){return t(e)}]),function(){return r.off(e,n)}},e.prototype.off=function(e,t){switch(typeof t){case"function":return void void this.seekNode_(e).registers.some(function(e,n,r){var i=e[1];if(t!==i)return!1;switch(n){case 0:return!void r.shift();case r.length-1:return!void r.pop();default:return!void r.splice(n,1)}});case"undefined":var n=this.seekNode_(e);return n.childrenMap=Object.create(null),n.childrenList=[],void(n.registers=[]);default:throw this.throwTypeErrorIfInvalidSubscriber_(t,e)}},e.prototype.once=function(e,t){var n=this;return void this.throwTypeErrorIfInvalidSubscriber_(t,e),this.on(e,function(r){return void n.off(e,t),t(r)},t)},e.prototype.emit=function(e,t,n){void this.drain_(e,t,n)},e.prototype.reflect=function(e,t){var n;return void this.emit(e,t,function(e,t){return n=t}),n},e.prototype.drain_=function(e,t,n){var r=[];if(void this.refsBelow_(this.seekNode_(e)).reduce(function(e,i){var u=i[2],o=i[3];if(!u)try{var c=o(t);n&&(r[r.length]=c)}catch(s){void 0!==s&&null!==s&&void console.error(s+"")}},void 0),void this.refsAbove_(this.seekNode_(e)).reduce(function(e,n){var r=n[2],i=n[3];if(r)try{void i(t)}catch(u){void 0!==u&&null!==u&&void console.error(u)}},void 0),n)try{void n(t,r)}catch(i){void console.error(i)}},e.prototype.refs=function(e){return this.refsBelow_(this.seekNode_(e))},e.prototype.refsAbove_=function(e){var t=e.parent,r=e.registers;for(r=n.concat([],r);t;)r=n.concat(r,t.registers),t=t.parent;return r},e.prototype.refsBelow_=function(e){var t=e.childrenList,r=e.childrenMap,i=e.registers;i=n.concat([],i);for(var u=0;u<t.length;++u){var o=t[u],c=this.refsBelow_(r[o]);i=n.concat(i,c),0===c.length&&(void delete r[o],void t.splice(t.indexOf(o),1),void--u)}return i},e.prototype.seekNode_=function(e){for(var t=this.node_,n=0,r=e;n<r.length;n++){var i=r[n],u=t.childrenMap;u[i+""]||(void t.childrenList.push(i+""),t.childrenList=t.childrenList.sort(),u[i+""]={parent:t,childrenMap:Object.create(null),childrenList:[],registers:[]}),t=u[i+""]}return t},e.prototype.throwTypeErrorIfInvalidSubscriber_=function(e,t){switch(typeof e){case"function":return;default:throw new TypeError("Spica: Observable: Invalid subscriber.\n\t"+e)}},e}();t.Observable=r}),define("src/lib/sqid",["require","exports"],function(e,t){"use strict";function n(e){return void 0===e?(1e15+ ++r+"").slice(1):(1e15+e+"").slice(1)}var r=0;t.sqid=n}),define("src/lib/type",["require","exports"],function(e,t){"use strict";function n(e){return Object.prototype.toString.call(e).split(" ").pop().slice(0,-1)}t.type=n}),define("src/lib/collection/datamap",["require","exports","src/lib/sqid","src/lib/type"],function(e,t,n,r){"use strict";function i(e){return e instanceof Object==!1}var u=function(){function e(){this.store=new Map,this.weakstore=new WeakMap}return e.prototype.stringify=function(e){switch(typeof e){case"undefined":return"0:"+e;case"boolean":return"1:"+e;case"number":return"2:"+(1e3+(""+e).length)+":"+e;case"string":return"3:"+(1e14+e.length)+":"+e;default:return i(e)?"8:"+e:Array.isArray(e)?"9:[ "+this.stringifyArray(e)+" ]":"9:{ "+(this.weakstore.has(e)?this.weakstore.get(e):this.stringifyObject(e)||this.weakstore.set(e,n.sqid()))+" }"}},e.prototype.stringifyArray=function(e){for(var t="",n=0,r=e;n<r.length;n++){var i=r[n];t+=""+this.stringify(i)}return t},e.prototype.stringifyObject=function(e){if("Object"!==r.type(e))return"";for(var t=Object.keys(e),n="",i=0,u=t;i<u.length;i++){var o=u[i];n+=this.stringify(o)+": "+this.stringify(e[o])}return n||" "},e.prototype.get=function(e){return(this.store.get(this.stringify(e))||[])[1]},e.prototype.set=function(e,t){return void this.store.set(this.stringify(e),[e,t]),this},e.prototype.has=function(e){return this.store.has(this.stringify(e))},e.prototype["delete"]=function(e){return this.store["delete"](this.stringify(e))},e.prototype.clear=function(){return this.store.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this.store.size},enumerable:!0,configurable:!0}),e}();t.DataMap=u}),define("src/lib/tick",["require","exports"],function(e,t){"use strict";var n;!function(e){function t(e){void i.push(e),void r()}function n(){void r(),void--u;for(var e=i.length;e-- >0;)void i.shift()()}function r(){if(0!==i.length)for(;u<o.length;)void setTimeout(n,o[u%o.length]),void++u}e.queue=t;var i=[],u=0,o=[0,4,10,20,25].reverse()}(n||(n={}));var r=Function("return typeof process === 'object' && typeof window !== 'object'")();t.Tick=r?Function("return fn => process.nextTick(fn)")():n.queue}),define("src/lib/thenable",["require","exports"],function(e,t){"use strict";function n(e){return!!e&&"object"==typeof e&&void 0!==e.then}t.isThenable=n}),define("src/lib/noop",["require","exports"],function(e,t){"use strict";function n(){}t.noop=n}),define("src/lib/supervisor",["require","exports","src/lib/observable","src/lib/collection/datamap","src/lib/tick","src/lib/thenable","src/lib/concat","src/lib/noop"],function(e,t,n,r,i,u,o,c){"use strict";function s(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}var a=function(){function e(t){var i=this,u=void 0===t?{}:t,o=u.name,s=void 0===o?"":o,a=u.dependencies,f=void 0===a?[]:a,d=u.retry,l=void 0!==d&&d,p=u.timeout,h=void 0===p?0:p,v=u.destructor,m=void 0===v?c.noop:v;if(this.deps=new r.DataMap,this.events={exec:new n.Observable,fail:new n.Observable,loss:new n.Observable,exit:new n.Observable},this.procs=new n.Observable,this.alive=!0,this.registerable=!0,this.scheduled=!1,this.workerSharedResource={procs:this.procs,dependenciesStack:[]},this.queue=[],this.constructor===e)throw new Error("Spica: Supervisor: Cannot instantiate abstract classes.");this.name=s,void f.reduce(function(e,t){var n=t[0],r=t[1];return void i.deps.set(n,r)},void 0),this.retry=l,this.timeout=h,this.destructor_=m,void++this.constructor.count}return e.prototype.destructor=function(e){for(void this.checkState(),this.alive=!1;this.queue.length>0;){var t=this.queue.shift(),n=t[0],r=t[1];void this.events.loss.emit(n,[n,void 0,r])}try{void this.destructor_(e)}catch(i){void console.error(i)}void--this.constructor.count,void Object.freeze(this)},e.prototype.schedule=function(){var e=this;this.alive&&(this.scheduled||(void i.Tick(function(t){e.alive&&(e.scheduled=!1,void e.drain())}),this.scheduled=!0))},e.prototype.register=function(e,t){if(void this.checkState(),!this.registerable)throw new Error("Spica: Supervisor: Supervisor "+this.name+" cannot register process during the exiting.");return e=o.concat([],e),void this.schedule(),new d(this,this.workerSharedResource,e,t,this.deps.get(e)||[]).terminate},e.prototype.call=function(e,t,n,r){var i=this;void 0===n&&(n=this.timeout),void 0===r&&(r=c.noop),void this.checkState(),e=o.concat([],e),void this.queue.push([e,t,function(e,t){return void r(t,e)},n,Date.now()]),void this.schedule(),n>0!=!1&&void setTimeout(function(){return i.drain(e)},n)},e.prototype.cast=function(e,t,n){void 0===n&&(n=this.retry),void this.checkState();var r=this.procs.reflect(e,new f.Call(t));return 0===r.length&&void this.events.fail.emit(e,[e,void 0,t]),r.length>0||!n?r:this.cast(e,t,!1)},e.prototype.refs=function(e){return void this.checkState(),this.procs.refs(e).map(function(e){var t=(e[0],e[1]),n=t(void 0);return[n.namespace,n.process,n.terminate]})},e.prototype.terminate=function(e,t){void this.checkState(),void 0===e&&(this.registerable=!1),void this.procs.emit(e||[],new f.Exit(t)),void this.procs.off(e||[]),void 0===e&&void this.destructor(t)},e.prototype.checkState=function(){if(!this.alive)throw new Error("Spica: Supervisor: Supervisor "+this.name+" already exited.")},e.prototype.drain=function(e){void 0===e&&(e=[]);for(var t,n=Date.now(),r=function(r){var u=i.queue[r],o=u[0],c=u[1],s=u[2],a=u[3],d=u[4],l=e.every(function(e,t){return e===o[t]})?i.procs.reflect(o,new f.Call(c)):[];if(0===l.length&&void i.events.fail.emit(o,[o,void 0,c]),0===l.length&&n<d+a)return t=r,"continue";if(0===r?void i.queue.shift():void i.queue.splice(r,1),void--r,0===l.length&&void i.events.loss.emit(o,[o,void 0,c]),!s)return t=r,"continue";try{void s(c,l)}catch(p){void console.error(p)}t=r},i=this,u=0;u<this.queue.length;++u){r(u);u=t}},e.count=0,e.procs=0,e}();t.Supervisor=a;var f;!function(e){var t=function(){function e(){}return e}(),n=function(e){function t(t){e.call(this),this.namespace=t}return __extends(t,e),t}(t);e.Deps=n;var r=function(e){function t(t){e.call(this),this.data=t}return __extends(t,e),t}(t);e.Call=r;var i=function(e){function t(t){e.call(this),this.reason=t}return __extends(t,e),t}(t);e.Exit=i}(f||(f={}));var d=function(){function e(t,n,r,i,u){var o=this;this.sv=t,this.sharedResource=n,this.namespace=r,this.process=i,this.dependencies=u,this.alive=!0,this.called=!1,this.concurrency=1,this.receive=function(t){return e.prototype.receive.call(o,t)},this.terminate=function(t){return e.prototype.terminate.call(o,t)},this.sharedResource.allRefsCache=void 0,void++this.sv.constructor.procs,void this.sharedResource.procs.on(r,this.receive)}return e.prototype.destructor=function(e){void this.checkState(),void this.sharedResource.procs.off(this.namespace,this.receive),this.alive=!1,void--this.sv.constructor.procs,this.sharedResource.allRefsCache=void 0,void Object.freeze(this),void this.sv.events.exit.emit(this.namespace,[this.namespace,this.process,e])},e.prototype.tryDependencyResolving=function(e){if(this.receive(new f.Deps(this.namespace)))return void(this.sharedResource.dependenciesStack=[]);throw void(this.sharedResource.dependenciesStack=[])},e.prototype.receive=function(e){var t=this;if(void this.checkState(),void 0===e)return this;if(e instanceof f.Deps){if(e.namespace.length!==this.namespace.length)return!1;if(0===this.concurrency)return!1;for(var n=0,r=this.sharedResource.dependenciesStack;n<r.length;n++){var i=r[n];if(s(this.namespace,i))return!0}return void this.sharedResource.dependenciesStack.push(this.namespace),this.dependencies.every(function(e){return(t.sharedResource.allRefsCache=t.sharedResource.allRefsCache||t.sharedResource.procs.refs([])).some(function(t){var n=t[0],r=t[1];return s(n,e)&&!!r(new f.Deps(e))})})}if(e instanceof f.Call){if(0===this.concurrency)throw void 0;void this.tryDependencyResolving(e),this.called||(this.called=!0,void this.sv.events.exec.emit(this.namespace,[this.namespace,this.process]));try{void--this.concurrency;var o=(0,this.process)(e.data);return u.isThenable(o)?void o.then(function(e){void t.sv.schedule(),t.alive&&void++t.concurrency},function(e){void t.sv.schedule(),t.alive&&(void++t.concurrency,void t.terminate(e))}):void++this.concurrency,o}catch(c){throw void void this.terminate(c)}}if(e instanceof f.Exit)throw void void this.terminate(e.reason);throw new TypeError("Spica: Supervisor: Invalid command: "+e)},e.prototype.terminate=function(e){void this.destructor(e)},e.prototype.checkState=function(){if(!this.alive)throw new Error("Spica: Supervisor: Process "+this.namespace+"/"+this.process+" already exited.")},e}()}),define("src/lib/monad/lazy",["require","exports"],function(e,t){"use strict";var n=function(){function e(e){this.thunk=e}return e.prototype.evaluate=function(){return this.memory_=this.memory_||this.thunk()},e}();t.Lazy=n}),define("src/lib/monad/functor",["require","exports","src/lib/monad/lazy"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Lazy);t.Functor=r}),define("src/lib/monad/applicative",["require","exports","src/lib/monad/functor"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Functor);t.Applicative=r;var r;!function(e){}(r=t.Applicative||(t.Applicative={}))}),define("src/lib/monad/monad",["require","exports","src/lib/monad/applicative"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Applicative);t.Monad=r;var r;!function(e){}(r=t.Monad||(t.Monad={}))}),define("src/lib/monad/monadplus",["require","exports","src/lib/monad/monad"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Monad);t.MonadPlus=r}),define("src/lib/monad/maybe.impl",["require","exports","src/lib/monad/monadplus"],function(e,t,n){"use strict";function r(){throw new Error("Spica: Maybe: Invalid thunk call.")}var i=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.fmap=function(e){return this.bind(function(t){return new u(e(t))})},t.prototype.bind=function(e){var n=this;return new t(function(){var r=n.evaluate();if(r instanceof u)return e(r.extract());if(r instanceof o)return r;if(r instanceof t)return r.bind(e);throw new TypeError("Spica: Maybe: Invalid monad value.\n\t"+r)})},t.prototype.extract=function(e){return this.evaluate().extract(e)},t}(n.MonadPlus);t.Maybe=i;var i;!function(e){function t(e){return new u(e)}function n(e){return function(t){return e.bind(function(e){return t.fmap(function(t){return e(t)})})}}function r(e){return new u(e)}e.pure=t,e.ap=n,e.Return=r}(i=t.Maybe||(t.Maybe={}));var u=function(e){function t(t){e.call(this,r),this.a=t}return __extends(t,e),t.prototype.bind=function(e){var t=this;return new i(function(){return e(t.extract())})},t.prototype.extract=function(e){return this.a},t}(i);t.Just=u;var o=function(e){function t(){e.call(this,r)}return __extends(t,e),t.prototype.bind=function(e){return this},t.prototype.extract=function(e){if(!e)throw void 0;return e()},t}(i);t.Nothing=o;var i;!function(e){function t(t,n){return new e(function(){return t.fmap(function(){return t}).extract(function(){return n})})}e.mzero=new o,e.mplus=t}(i=t.Maybe||(t.Maybe={}))}),define("src/lib/monad/maybe",["require","exports","src/lib/monad/maybe.impl"],function(e,t,n){"use strict";var r;!function(e){function t(e){return new n.Just(e)}e.pure=n.Maybe.pure,e.ap=n.Maybe.ap,e.Return=n.Maybe.Return,e.mzero=n.Maybe.mzero,e.mplus=n.Maybe.mplus,e.Just=t,e.Nothing=n.Maybe.mzero}(r=t.Maybe||(t.Maybe={})),t.Just=r.Just,t.Nothing=r.Nothing,t.Return=r.Return}),define("src/lib/monad/either.impl",["require","exports","src/lib/monad/monad"],function(e,t,n){"use strict";function r(){throw new Error("Spica: Either: Invalid thunk call.")}var i=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.fmap=function(e){return this.bind(function(t){return new o(e(t))})},t.prototype.bind=function(e){var n=this;return new t(function(){var r=n.evaluate();if(r instanceof u)return r;if(r instanceof o)return e(r.extract());if(r instanceof t)return r.bind(e);throw new TypeError("Spica: Either: Invalid monad value.\n\t"+r)})},t.prototype.extract=function(e){return this.evaluate().extract(e)},t}(n.Monad);t.Either=i;var i;!function(e){function t(e){return new o(e)}function n(e){return function(t){return e.bind(function(e){return t.fmap(function(t){return e(t)})})}}function r(e){return new o(e)}e.pure=t,e.ap=n,e.Return=r}(i=t.Either||(t.Either={}));var u=function(e){function t(t){e.call(this,r),this.a=t}return __extends(t,e),t.prototype.bind=function(e){return this},t.prototype.extract=function(e){if(!e)throw this.a;return e(this.a)},t}(i);t.Left=u;var o=function(e){function t(t){e.call(this,r),this.b=t}return __extends(t,e),t.prototype.bind=function(e){var t=this;return new i(function(){return e(t.extract())})},t.prototype.extract=function(e){return this.b},t}(i);t.Right=o}),define("src/lib/monad/either",["require","exports","src/lib/monad/either.impl"],function(e,t,n){"use strict";var r;!function(e){function t(e){return new n.Left(e)}function r(e){return new n.Right(e)}e.pure=n.Either.pure,e.ap=n.Either.ap,e.Return=n.Either.Return,e.Left=t,e.Right=r}(r=t.Either||(t.Either={})),t.Left=r.Left,t.Right=r.Right,t.Return=r.Return}),define("src/lib/cancelable",["require","exports","src/lib/noop","src/lib/monad/maybe","src/lib/monad/either"],function(e,t,n,r,i){"use strict";var u=function(){function e(){var e=this;this.canceled=!1,this.promise=function(t){return e.canceled?e.promise_=e.promise_||new Promise(function(t,n){return void n(e.reason)}):Promise.resolve(t)},this.maybe=function(t){return e.canceled?r.Nothing:r.Just(t)},this.either=function(t){return e.canceled?i.Left(e.reason):i.Right(t)},this.cancel=function(t){return e.cancel=n.noop,e.canceled=!0,void(e.reason=t)}}return e}();t.Cancelable=u}),define("src/lib/monad/sequence/core",["require","exports","src/lib/monad/monadplus"],function(e,t,n){"use strict";var r=function(e){function t(t,n){e.call(this),this.cons=t,this.memory=n}return __extends(t,e),t}(n.MonadPlus);t.Sequence=r;var r;!function(e){}(r=t.Sequence||(t.Sequence={}));var r;!function(e){function t(e){return r.iterator(e)!==i.done}var n;!function(t){function n(t,n){switch(arguments.length){case 0:return[];case 1:return[t];case 2:return[t,n];default:throw e.Exception.invalidConsError(arguments)}}t.cons=n}(n=e.Data||(e.Data={}));var r;!function(e){function t(e){return e[0]}function n(e){return e[1]}function r(e){return e[2]}e.value=t,e.iterator=n,e.index=r}(r=e.Thunk||(e.Thunk={}));var i;!function(t){function n(t,i,u){return e.isIterable(t)?u(t,function(){return n(r.iterator(t)(),i,u)}):i(t)}t.done=function(){return[void 0,t.done,-1]},t.when=n}(i=e.Iterator||(e.Iterator={})),e.isIterable=t;var u;!function(e){function t(e){return console.error(e,e.length,e[0],e[1]),new TypeError("Spica: Sequence: Invalid parameters of cons.")}function n(e){return console.error(e),new TypeError("Spica: Sequence: Invalid data.")}function r(e){return console.error(e),new TypeError("Spica: Sequence: Invalid thunk.")}e.invalidConsError=t,e.invalidDataError=n,e.invalidThunkError=r}(u=e.Exception||(e.Exception={}))}(r=t.Sequence||(t.Sequence={}))}),define("src/lib/monad/sequence/member/static/from",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.from=function(e){return new n.Sequence(function(t,n){return void 0===t&&(t=0),t<e.length?n(e[t],++t):n()})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/write",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.write=function(e){return new n.Sequence(function(t,n){return e.length>0?n(e.shift(),e):n()})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/random",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.random=function(e){switch(void 0===e&&(e=function(){return Math.random()}),!0){case Array.isArray(e):return this.random().map(function(t){return e[t*e.length|0]});default:return new n.Sequence(function(t,n){return n(e(),NaN)})}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/concat",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.concat=function(e){return new n.Sequence(function(t,r){var i=void 0===t?[function(){return e.iterate()},n.Sequence.Iterator.done]:t,u=i[0],o=i[1];return n.Sequence.Iterator.when(u(),function(){return r()},function(e,t){return o=o===n.Sequence.Iterator.done?function(){return n.Sequence.Thunk.value(e).iterate()}:o,n.Sequence.Iterator.when(o(),function(){return o=n.Sequence.Iterator.done,t()},function(t){return r(n.Sequence.Thunk.value(t),[function(){return e},n.Sequence.Thunk.iterator(t)])})})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/zip",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.zip=function(e,t){return new n.Sequence(function(r,i){var u=void 0===r?[function(){return e.iterate()},function(){return t.iterate()}]:r,o=u[0],c=u[1];return n.Sequence.Iterator.when(o(),function(){return i()},function(e){return n.Sequence.Iterator.when(c(),function(){return i()},function(t){return i([n.Sequence.Thunk.value(e),n.Sequence.Thunk.value(t)],[n.Sequence.Thunk.iterator(e),n.Sequence.Thunk.iterator(t)])})})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/union",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";function r(e,t,r){return new n.Sequence(function(i,u){var o=void 0===i?[function(){return t.iterate()},function(){return r.iterate()}]:i,c=o[0],s=o[1];return n.Sequence.Iterator.when(c(),function(){return n.Sequence.Iterator.when(s(),function(){return u()},function(e){return u(n.Sequence.Thunk.value(e),[n.Sequence.Iterator.done,n.Sequence.Thunk.iterator(e)])})},function(t){return n.Sequence.Iterator.when(s(),function(){return u(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),n.Sequence.Iterator.done])},function(r){var i=e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.value(r));return i<0?u(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),s]):i>0?u(n.Sequence.Thunk.value(r),[c,n.Sequence.Thunk.iterator(r)]):u(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),n.Sequence.Thunk.iterator(r)])})})})}var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.union=function(e,t){return t.reduce(function(t,n){return r(e,t,n)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/static/intersect",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";function r(e,t,r){return new n.Sequence(function(i,u){var o=void 0===i?[function(){return t.iterate()},function(){return r.iterate()}]:i,c=o[0],s=o[1];return n.Sequence.Iterator.when(c(),function(){return u()},function(t,r){return n.Sequence.Iterator.when(s(),function(){return u()},function(i,o){var c=e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.value(i));return c<0?(s=function(){return i},r()):c>0?o():u(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),n.Sequence.Thunk.iterator(i)])})})})}var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.intersect=function(e,t){return t.reduce(function(t,n){return r(e,t,n)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/static/pure",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.pure=function(e){return new n.Sequence(function(t,n){return n(e)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/ap",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.ap=function(e){return function(t){return e.bind(function(e){return t.fmap(function(t){return e(t)})})}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/return",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.Return=function(e){return new n.Sequence(function(t,n){return n(e)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mempty",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mempty=new n.Sequence(function(e,t){return t()}),t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mconcat",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";function r(e,t){return new n.Sequence(function(r,i){var u=void 0===r?[function(){return e.iterate()},function(){return t.iterate()}]:r,o=u[0],c=u[1];return n.Sequence.Iterator.when(o(),function(){return n.Sequence.Iterator.when(c(),function(){return i()},function(e){return i(n.Sequence.Thunk.value(e),[n.Sequence.Iterator.done,n.Sequence.Thunk.iterator(e)])})},function(e){return i(n.Sequence.Thunk.value(e),[n.Sequence.Thunk.iterator(e),c])})})}var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mconcat=function(e){return e.reduce(function(e,t){return r(e,t)},n.Sequence.from([]))},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/static/mappend",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mappend=function(e,t){return n.Sequence.mconcat([e,t])},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mzero",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mzero=n.Sequence.mempty,t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mplus",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mplus=n.Sequence.mappend,t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/iterate",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.iterate=function(){return this.iterate_()},t.prototype.iterate_=function(e,t){var r=this;void 0===t&&(t=0);var i=this.memory?this.memory.has(t)?this.memory.get(t):this.memory.set(t,this.cons(e,n.Sequence.Data.cons)).get(t):this.cons(e,n.Sequence.Data.cons);switch(i.length){case 0:return[void 0,n.Sequence.Iterator.done,-1];case 1:return[i[0],function(){return n.Sequence.Iterator.done()},t];case 2:return[i[0],function(){return r.iterate_(i[1],t+1)},t];default:throw n.Sequence.Exception.invalidDataError(i)}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/memoize",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.memoize=function(e){return void 0===e&&(e=this.memory||new Map),new n.Sequence(this.cons,this.memory||e)},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/read",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.read=function(){for(var e=this,t=[],i=function(){return e.iterate()};;){var u=i();if(!n.Sequence.isIterable(u))return t;void r.concat(t,[n.Sequence.Thunk.value(u)]),i=n.Sequence.Thunk.iterator(u)}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/take",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.take=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(e>0?r():n.Sequence.Iterator.done(),function(){return i()},function(t){return n.Sequence.Thunk.index(t)+1<e?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):i(n.Sequence.Thunk.value(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/drop",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.drop=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return n.Sequence.Thunk.index(t)<e?r():i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/takeWhile",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.takeWhile=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t){return e(n.Sequence.Thunk.value(t))?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):i()})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/dropWhile",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.dropWhile=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t))?r():i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/takeUntil",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.takeUntil=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t){return e(n.Sequence.Thunk.value(t))?i(n.Sequence.Thunk.value(t)):i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)); | ||
})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/dropUntil",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.dropUntil=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t))?r():i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/fmap",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.fmap=function(e){var t=this;return new n.Sequence(function(r){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return n.Sequence.Data.cons()},function(t){return n.Sequence.Data.cons(e(n.Sequence.Thunk.value(t)),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/bind",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.bind=function(e){return n.Sequence.concat(this.fmap(e))},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/mapM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.mapM=function(e){var t=this;return this.take(1).bind(function(){var i=t.read();switch(i.length){case 0:return n.Sequence.from([]);default:var u=i.shift();return e(u).bind(function(t){return 0===i.length?n.Sequence.from([[t]]):n.Sequence.from(i).mapM(e).fmap(function(e){return r.concat([t],e)})})}})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/filterM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.filterM=function(e){var t=this;return this.take(1).bind(function(){var i=t.read();switch(i.length){case 0:return n.Sequence.from([[]]);default:var u=i.shift();return e(u).bind(function(t){return t?0===i.length?n.Sequence.from([[u]]):n.Sequence.from(i).filterM(e).fmap(function(e){return r.concat([u],e)}):0===i.length?n.Sequence.from([[]]):n.Sequence.from(i).filterM(e)})}})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/map",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.map=function(e){var t=this;return new n.Sequence(function(r){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return n.Sequence.Data.cons()},function(t){return n.Sequence.Data.cons(e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.index(t)),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/filter",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.filter=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.index(t))?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):r()})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/scan",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.scan=function(e,t){var r=this;return new n.Sequence(function(i){var u=void 0===i?[void 0,void 0]:i,o=u[0],c=void 0===o?t:o,s=u[1],a=void 0===s?function(){return r.iterate()}:s;return n.Sequence.Iterator.when(a(),function(){return n.Sequence.Data.cons()},function(t){return n.Sequence.Data.cons(c=e(c,n.Sequence.Thunk.value(t)),[c,n.Sequence.Thunk.iterator(t)])})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/assign",["require","exports","src/lib/type"],function(e,t,n){"use strict";function r(e){return function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(void 0===t||null===t)throw new TypeError("Spica: assign: Cannot walk on "+t+".");for(var i=0,u=n;i<u.length;i++){var o=u[i];if(void 0!==o&&null!==o)for(var c=0,s=Object.keys(Object(o));c<s.length;c++){var a=s[c],f=Object.getOwnPropertyDescriptor(Object(o),a);void 0!==f&&f.enumerable&&void e(a,Object(t),Object(o))}}return Object(t)}}t.assign=r(function(e,t,n){return t[e]=n[e]}),t.clone=r(function(e,r,i){switch(n.type(i[e])){case"Array":return r[e]=t.clone([],i[e]);case"Function":case"Object":return r[e]=t.clone({},i[e]);default:return r[e]=i[e]}}),t.extend=r(function(e,r,i){switch(n.type(i[e])){case"Array":return r[e]=t.extend([],i[e]);case"Function":case"Object":switch(n.type(r[e])){case"Function":case"Object":return r[e]=t.extend(r[e],i[e]);default:return r[e]=t.extend({},i[e])}default:return r[e]=i[e]}})}),define("src/lib/compose",["require","exports","src/lib/assign","src/lib/concat"],function(e,t,n,r){"use strict";function i(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return r.concat([e],t).reduce(function(e,t){void n.assign(e.prototype,t.prototype);for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e})}t.compose=i}),define("src/lib/monad/sequence",["require","exports","src/lib/monad/sequence/core","src/lib/monad/sequence/member/static/from","src/lib/monad/sequence/member/static/write","src/lib/monad/sequence/member/static/random","src/lib/monad/sequence/member/static/concat","src/lib/monad/sequence/member/static/zip","src/lib/monad/sequence/member/static/union","src/lib/monad/sequence/member/static/intersect","src/lib/monad/sequence/member/static/pure","src/lib/monad/sequence/member/static/ap","src/lib/monad/sequence/member/static/return","src/lib/monad/sequence/member/static/mempty","src/lib/monad/sequence/member/static/mconcat","src/lib/monad/sequence/member/static/mappend","src/lib/monad/sequence/member/static/mzero","src/lib/monad/sequence/member/static/mplus","src/lib/monad/sequence/member/instance/iterate","src/lib/monad/sequence/member/instance/memoize","src/lib/monad/sequence/member/instance/read","src/lib/monad/sequence/member/instance/take","src/lib/monad/sequence/member/instance/drop","src/lib/monad/sequence/member/instance/takeWhile","src/lib/monad/sequence/member/instance/dropWhile","src/lib/monad/sequence/member/instance/takeUntil","src/lib/monad/sequence/member/instance/dropUntil","src/lib/monad/sequence/member/instance/fmap","src/lib/monad/sequence/member/instance/bind","src/lib/monad/sequence/member/instance/mapM","src/lib/monad/sequence/member/instance/filterM","src/lib/monad/sequence/member/instance/map","src/lib/monad/sequence/member/instance/filter","src/lib/monad/sequence/member/instance/scan","src/lib/compose"],function(e,t,n,r,i,u,o,c,s,a,f,d,l,p,h,v,m,b,q,y,S,x,_,w,g,k,T,M,O,I,j,R,P,E,D){"use strict";t.Sequence=n.Sequence,D.compose(n.Sequence,r["default"],i["default"],u["default"],o["default"],c["default"],s["default"],a["default"],f["default"],d["default"],l["default"],p["default"],h["default"],v["default"],m["default"],b["default"],q["default"],y["default"],S["default"],x["default"],_["default"],w["default"],g["default"],k["default"],T["default"],M["default"],O["default"],I["default"],j["default"],R["default"],P["default"],E["default"])}),define("src/lib/curry",["require","exports"],function(e,t){"use strict";function n(e,t,r){return e.length===t.length?e.apply(r,t):function(){for(var i=[],u=0;u<arguments.length;u++)i[u-0]=arguments[u];return n(e,t.concat(i),r)}}var r=this;t.curry=function(e,t){return void 0===t&&(t=r),0===e.length?function(){return e.call(t)}:n(e,[],t)}}),define("src/lib/flip",["require","exports","src/lib/curry"],function(e,t,n){"use strict";function r(e){return n.curry(function(t,n){return e.length>1?e(n,t):e(n)(t)})}t.flip=r}),define("src/lib/collection/attrmap",["require","exports"],function(e,t){"use strict";var n=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,t){return this.store.get(e)&&this.store.get(e).get(t)},e.prototype.set=function(e,t,n){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new Map).get(e);return void r.set(t,n),this},e.prototype.has=function(e,t){return this.store.has(e)&&this.store.get(e).has(t)},e.prototype["delete"]=function(e,t){return void 0===t?this.store["delete"](e):!!this.store.has(e)&&this.store.get(e)["delete"](t)},e}();t.AttrMap=n}),define("src/lib/collection/relationmap",["require","exports"],function(e,t){"use strict";var n=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,t){return this.store.get(e)&&this.store.get(e).get(t)},e.prototype.set=function(e,t,n){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new WeakMap).get(e);return void r.set(t,n),this},e.prototype.has=function(e,t){return this.store.has(e)&&this.store.get(e).has(t)},e.prototype["delete"]=function(e,t){return void 0===t?this.store["delete"](e):!!this.store.has(e)&&this.store.get(e)["delete"](t)},e}();t.RelationMap=n}),define("src/lib/mixin",["require","exports","src/lib/assign"],function(e,t,n){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++)e[t-0]=arguments[t];return e.reduceRight(function(e,t){return i(t,e)},function(){function e(){}return e}())}function i(e,t){var r=function(){function n(){return e.apply(t.apply(this,arguments)||this,arguments)}return n}();void n.assign(r.prototype,e.prototype,t.prototype);for(var i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);for(var i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);return r}t.Mixin=r}),define("src/lib/fingerprint",["require","exports"],function(e,t){"use strict";function n(){return i(u([o(window.navigator),o(window.screen),o((new Date).getTimezoneOffset())].join()))}function r(){return i(u([o(process)].join()))}function i(e){return e.split("").reduce(function(e,t,n){return(+t*n+e)%1e9||e-+t},0)}function u(e){return e.split("").map(function(e){return e.charCodeAt(0)}).join("")}function o(e,t){if(void 0===t&&(t=5),t>0&&e&&"object"==typeof e){var n="{";for(var r in e)n+='"'+r+'": '+o(e[r],t-1)+",";return n+="}"}return!e||e.toString?'"'+e+'"':'"'+Object.prototype.toString.call(e)+'"'}t.FINGERPRINT="object"==typeof window?n():r(),t.browser=n,t.server=r,t.hash=i,t.str2digit=u,t.stringify=o}),define("src/lib/uuid",["require","exports","src/lib/fingerprint"],function(e,t,n){"use strict";function r(){var e=o=o*Date.now()%1e15;if(e<16||1e15<e)throw new Error("Spica: uuid: Invalid uuid dynamic seed.");for(var t="",n=0,r=u;n<r.length;n++){var i=r[n];if("x"===i||"y"===i){var c=Math.random()*e%16|0,s="x"==i?c:3&c|8;t+=s.toString(16)}else t+=i}return t.toLowerCase()}var i=n.FINGERPRINT*Date.now()%1e15;if(!i||"number"!=typeof i||i<100||1e15<i)throw new Error("Spica: uuid: Invalid uuid static seed.\n\t"+n.FINGERPRINT);var u=Object.freeze("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("")),o=i;t.v4=r}),define("src/lib/sort",["require","exports"],function(e,t){"use strict";function n(e,t,n,r){if(void 0===r&&(r=!1),!r&&n*n>1.25*e.length)return e.sort(t);n=n<e.length-1?n:e.length-1;for(var i=0;i<n;++i)for(var u=i+1;u<e.length;++u)if(t(e[i],e[u])>0!=!1){var o=e[i];e[i]=e[u],e[u]=o}return e}t.sort=n}),define("src/export",["require","exports","src/lib/supervisor","src/lib/observable","src/lib/cancelable","src/lib/monad/sequence","src/lib/monad/maybe","src/lib/monad/either","src/lib/curry","src/lib/flip","src/lib/collection/datamap","src/lib/collection/attrmap","src/lib/collection/relationmap","src/lib/mixin","src/lib/tick","src/lib/fingerprint","src/lib/uuid","src/lib/sqid","src/lib/assign","src/lib/concat","src/lib/sort"],function(e,t,n,r,i,u,o,c,s,a,f,d,l,p,h,v,m,b,q,y,S){"use strict";t.Supervisor=n.Supervisor,t.Observable=r.Observable,t.Cancelable=i.Cancelable,t.Sequence=u.Sequence,t.Maybe=o.Maybe,t.Just=o.Just,t.Nothing=o.Nothing,t.Either=c.Either,t.Left=c.Left,t.Right=c.Right,t.curry=s.curry,t.flip=a.flip,t.DataMap=f.DataMap,t.AttrMap=d.AttrMap,t.RelationMap=l.RelationMap,t.Mixin=p.Mixin,t.Tick=h.Tick,t.FINGERPRINT=v.FINGERPRINT,t.uuid=m.v4,t.sqid=b.sqid,t.assign=q.assign,t.clone=q.clone,t.extend=q.extend,t.concat=y.concat,t.sort=S.sort}),define("spica",["require","exports","src/export"],function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}r(n)}); | ||
/*! spica v0.0.12 https://github.com/falsandtru/spica | (c) 2016, falsandtru | undefined License (undefined) */ | ||
define="function"==typeof define&&define.amd?define:function(){"use strict";var e="spica",t={};return function n(r,i,u){return u?void u.apply(this,i.map(function(e){switch(e){case"require":return"function"==typeof require?require:void 0;case"exports":return r.indexOf("/")===-1?t[r]="undefined"==typeof exports?self[r]=self[r]||{}:exports:t[r]=t.hasOwnProperty(r)?t[r]:{};default:return".d"===e.slice(-2)&&{}||t.hasOwnProperty(e)&&t[e]||"function"==typeof require&&require(e)||self[e]}})):void n(e,r,i)}}();var __extends=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)};define("src/lib/concat",["require","exports"],function(e,t){"use strict";function n(e,t){for(var n=0,r=t.length,i=e.length;n<r;++n)e[n+i]=t[n];return e}t.concat=n}),define("src/lib/observable",["require","exports","src/lib/concat"],function(e,t,n){"use strict";var r=function(){function e(){this.node_={parent:void 0,childrenMap:Object.create(null),childrenList:[],registers:[]}}return e.prototype.monitor=function(e,t,n){var r=this;return void 0===n&&(n=t),void this.throwTypeErrorIfInvalidSubscriber_(t,e),void this.seekNode_(e).registers.push([e,n,!0,t]),function(){return r.off(e,n)}},e.prototype.on=function(e,t,n){var r=this;return void 0===n&&(n=t),void this.throwTypeErrorIfInvalidSubscriber_(t,e),void this.seekNode_(e).registers.push([e,n,!1,function(e){return t(e)}]),function(){return r.off(e,n)}},e.prototype.off=function(e,t){switch(typeof t){case"function":return void void this.seekNode_(e).registers.some(function(e,n,r){var i=e[1];if(t!==i)return!1;switch(n){case 0:return!void r.shift();case r.length-1:return!void r.pop();default:return!void r.splice(n,1)}});case"undefined":var n=this.seekNode_(e);return n.childrenMap=Object.create(null),n.childrenList=[],void(n.registers=[]);default:throw this.throwTypeErrorIfInvalidSubscriber_(t,e)}},e.prototype.once=function(e,t){var n=this;return void this.throwTypeErrorIfInvalidSubscriber_(t,e),this.on(e,function(r){return void n.off(e,t),t(r)},t)},e.prototype.emit=function(e,t,n){void this.drain_(e,t,n)},e.prototype.reflect=function(e,t){var n;return void this.emit(e,t,function(e,t){return n=t}),n},e.prototype.drain_=function(e,t,n){var r=[];if(void this.refsBelow_(this.seekNode_(e)).reduce(function(e,i){var u=i[2],o=i[3];if(!u)try{var c=o(t);n&&(r[r.length]=c)}catch(s){void 0!==s&&null!==s&&void console.error(s+"")}},void 0),void this.refsAbove_(this.seekNode_(e)).reduce(function(e,n){var r=n[2],i=n[3];if(r)try{void i(t)}catch(u){void 0!==u&&null!==u&&void console.error(u)}},void 0),n)try{void n(t,r)}catch(i){void console.error(i)}},e.prototype.refs=function(e){return this.refsBelow_(this.seekNode_(e))},e.prototype.refsAbove_=function(e){var t=e.parent,r=e.registers;for(r=n.concat([],r);t;)r=n.concat(r,t.registers),t=t.parent;return r},e.prototype.refsBelow_=function(e){var t=e.childrenList,r=e.childrenMap,i=e.registers;i=n.concat([],i);for(var u=0;u<t.length;++u){var o=t[u],c=this.refsBelow_(r[o]);i=n.concat(i,c),0===c.length&&(void delete r[o],void t.splice(t.indexOf(o),1),void--u)}return i},e.prototype.seekNode_=function(e){for(var t=this.node_,n=0,r=e;n<r.length;n++){var i=r[n],u=t.childrenMap;u[i+""]||(void t.childrenList.push(i+""),t.childrenList=t.childrenList.sort(),u[i+""]={parent:t,childrenMap:Object.create(null),childrenList:[],registers:[]}),t=u[i+""]}return t},e.prototype.throwTypeErrorIfInvalidSubscriber_=function(e,t){switch(typeof e){case"function":return;default:throw new TypeError("Spica: Observable: Invalid subscriber.\n\t"+e)}},e}();t.Observable=r}),define("src/lib/sqid",["require","exports"],function(e,t){"use strict";function n(e){return void 0===e?(1e15+ ++r+"").slice(1):(1e15+e+"").slice(1)}var r=0;t.sqid=n}),define("src/lib/type",["require","exports"],function(e,t){"use strict";function n(e){return Object.prototype.toString.call(e).split(" ").pop().slice(0,-1)}t.type=n}),define("src/lib/collection/datamap",["require","exports","src/lib/sqid","src/lib/type"],function(e,t,n,r){"use strict";function i(e){return e instanceof Object==!1}var u=function(){function e(){this.store=new Map,this.weakstore=new WeakMap}return e.prototype.stringify=function(e){switch(typeof e){case"undefined":return"0:"+e;case"boolean":return"1:"+e;case"number":return"2:"+(1e3+(""+e).length)+":"+e;case"string":return"3:"+(1e14+e.length)+":"+e;default:return i(e)?"8:"+e:Array.isArray(e)?"9:[ "+this.stringifyArray(e)+" ]":"9:{ "+(this.weakstore.has(e)?this.weakstore.get(e):this.stringifyObject(e)||this.weakstore.set(e,n.sqid()))+" }"}},e.prototype.stringifyArray=function(e){for(var t="",n=0,r=e;n<r.length;n++){var i=r[n];t+=""+this.stringify(i)}return t},e.prototype.stringifyObject=function(e){if("Object"!==r.type(e))return"";for(var t=Object.keys(e),n="",i=0,u=t;i<u.length;i++){var o=u[i];n+=this.stringify(o)+": "+this.stringify(e[o])}return n||" "},e.prototype.get=function(e){return(this.store.get(this.stringify(e))||[])[1]},e.prototype.set=function(e,t){return void this.store.set(this.stringify(e),[e,t]),this},e.prototype.has=function(e){return this.store.has(this.stringify(e))},e.prototype["delete"]=function(e){return this.store["delete"](this.stringify(e))},e.prototype.clear=function(){return this.store.clear()},Object.defineProperty(e.prototype,"size",{get:function(){return this.store.size},enumerable:!0,configurable:!0}),e}();t.DataMap=u}),define("src/lib/tick",["require","exports"],function(e,t){"use strict";var n;!function(e){function t(e){void i.push(e),void r()}function n(){void r(),void--u;for(var e=i.length;e-- >0;)void i.shift()()}function r(){if(0!==i.length)for(;u<o.length;)void setTimeout(n,o[u%o.length]),void++u}e.queue=t;var i=[],u=0,o=[0,4,10,20,25].reverse()}(n||(n={}));var r=Function("return typeof process === 'object' && typeof window !== 'object'")();t.Tick=r?Function("return fn => process.nextTick(fn)")():n.queue}),define("src/lib/thenable",["require","exports"],function(e,t){"use strict";function n(e){return!!e&&"object"==typeof e&&void 0!==e.then}t.isThenable=n}),define("src/lib/noop",["require","exports"],function(e,t){"use strict";function n(){}t.noop=n}),define("src/lib/supervisor",["require","exports","src/lib/observable","src/lib/collection/datamap","src/lib/tick","src/lib/thenable","src/lib/concat","src/lib/noop"],function(e,t,n,r,i,u,o,c){"use strict";function s(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(var n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}var a=function(){function e(t){var i=this,u=void 0===t?{}:t,o=u.name,s=void 0===o?"":o,a=u.dependencies,f=void 0===a?[]:a,d=u.retry,l=void 0!==d&&d,p=u.timeout,h=void 0===p?0:p,v=u.destructor,m=void 0===v?c.noop:v;if(this.deps=new r.DataMap,this.events={exec:new n.Observable,fail:new n.Observable,loss:new n.Observable,exit:new n.Observable},this.procs=new n.Observable,this.alive=!0,this.registerable=!0,this.scheduled=!1,this.workerSharedResource={procs:this.procs,dependenciesStack:[]},this.queue=[],this.constructor===e)throw new Error("Spica: Supervisor: Cannot instantiate abstract classes.");this.name=s,void f.reduce(function(e,t){var n=t[0],r=t[1];return void i.deps.set(n,r)},void 0),this.retry=l,this.timeout=h,this.destructor_=m,void++this.constructor.count}return e.prototype.destructor=function(e){for(void this.checkState(),this.alive=!1;this.queue.length>0;){var t=this.queue.shift(),n=t[0],r=t[1];void this.events.loss.emit(n,[n,void 0,r])}try{void this.destructor_(e)}catch(i){void console.error(i)}void--this.constructor.count,void Object.freeze(this)},e.prototype.schedule=function(){var e=this;this.alive&&(this.scheduled||(void i.Tick(function(t){e.alive&&(e.scheduled=!1,void e.drain())}),this.scheduled=!0))},e.prototype.register=function(e,t){if(void this.checkState(),!this.registerable)throw new Error("Spica: Supervisor: Supervisor "+this.name+" cannot register process during the exiting.");return e=o.concat([],e),void this.schedule(),new d(this,this.workerSharedResource,e,t,this.deps.get(e)||[]).terminate},e.prototype.call=function(e,t,n,r){var i=this;void 0===n&&(n=this.timeout),void 0===r&&(r=c.noop),void this.checkState(),e=o.concat([],e),void this.queue.push([e,t,function(e,t){return void r(t,e)},n,Date.now()]),void this.schedule(),n>0!=!1&&void setTimeout(function(){return i.drain(e)},n)},e.prototype.cast=function(e,t,n){void 0===n&&(n=this.retry),void this.checkState();var r=this.procs.reflect(e,new f.Call(t));return 0===r.length&&void this.events.fail.emit(e,[e,void 0,t]),r.length>0||!n?r:this.cast(e,t,!1)},e.prototype.refs=function(e){return void this.checkState(),this.procs.refs(e).map(function(e){var t=(e[0],e[1]),n=t(void 0);return[n.namespace,n.process,n.terminate]})},e.prototype.terminate=function(e,t){void this.checkState(),void 0===e&&(this.registerable=!1),void this.procs.emit(e||[],new f.Exit(t)),void this.procs.off(e||[]),void 0===e&&void this.destructor(t)},e.prototype.checkState=function(){if(!this.alive)throw new Error("Spica: Supervisor: Supervisor "+this.name+" already exited.")},e.prototype.drain=function(e){void 0===e&&(e=[]);for(var t,n=Date.now(),r=function(r){var u=i.queue[r],o=u[0],c=u[1],s=u[2],a=u[3],d=u[4],l=e.every(function(e,t){return e===o[t]})?i.procs.reflect(o,new f.Call(c)):[];if(0===l.length&&void i.events.fail.emit(o,[o,void 0,c]),0===l.length&&n<d+a)return t=r,"continue";if(0===r?void i.queue.shift():void i.queue.splice(r,1),void--r,0===l.length&&void i.events.loss.emit(o,[o,void 0,c]),!s)return t=r,"continue";try{void s(c,l)}catch(p){void console.error(p)}t=r},i=this,u=0;u<this.queue.length;++u){r(u);u=t}},e.count=0,e.procs=0,e}();t.Supervisor=a;var f;!function(e){var t=function(){function e(){}return e}(),n=function(e){function t(t){e.call(this),this.namespace=t}return __extends(t,e),t}(t);e.Deps=n;var r=function(e){function t(t){e.call(this),this.data=t}return __extends(t,e),t}(t);e.Call=r;var i=function(e){function t(t){e.call(this),this.reason=t}return __extends(t,e),t}(t);e.Exit=i}(f||(f={}));var d=function(){function e(t,n,r,i,u){var o=this;this.sv=t,this.sharedResource=n,this.namespace=r,this.process=i,this.dependencies=u,this.alive=!0,this.called=!1,this.concurrency=1,this.receive=function(t){return e.prototype.receive.call(o,t)},this.terminate=function(t){return e.prototype.terminate.call(o,t)},this.sharedResource.allRefsCache=void 0,void++this.sv.constructor.procs,void this.sharedResource.procs.on(r,this.receive)}return e.prototype.destructor=function(e){void this.checkState(),void this.sharedResource.procs.off(this.namespace,this.receive),this.alive=!1,void--this.sv.constructor.procs,this.sharedResource.allRefsCache=void 0,void Object.freeze(this),void this.sv.events.exit.emit(this.namespace,[this.namespace,this.process,e])},e.prototype.tryDependencyResolving=function(e){if(this.receive(new f.Deps(this.namespace)))return void(this.sharedResource.dependenciesStack=[]);throw void(this.sharedResource.dependenciesStack=[])},e.prototype.receive=function(e){var t=this;if(void this.checkState(),void 0===e)return this;if(e instanceof f.Deps){if(e.namespace.length!==this.namespace.length)return!1;if(0===this.concurrency)return!1;for(var n=0,r=this.sharedResource.dependenciesStack;n<r.length;n++){var i=r[n];if(s(this.namespace,i))return!0}return void this.sharedResource.dependenciesStack.push(this.namespace),this.dependencies.every(function(e){return(t.sharedResource.allRefsCache=t.sharedResource.allRefsCache||t.sharedResource.procs.refs([])).some(function(t){var n=t[0],r=t[1];return s(n,e)&&!!r(new f.Deps(e))})})}if(e instanceof f.Call){if(0===this.concurrency)throw void 0;void this.tryDependencyResolving(e),this.called||(this.called=!0,void this.sv.events.exec.emit(this.namespace,[this.namespace,this.process]));try{void--this.concurrency;var o=(0,this.process)(e.data);return u.isThenable(o)?void o.then(function(e){void t.sv.schedule(),t.alive&&void++t.concurrency},function(e){void t.sv.schedule(),t.alive&&(void++t.concurrency,void t.terminate(e))}):void++this.concurrency,o}catch(c){throw void void this.terminate(c)}}if(e instanceof f.Exit)throw void void this.terminate(e.reason);throw new TypeError("Spica: Supervisor: Invalid command: "+e)},e.prototype.terminate=function(e){void this.destructor(e)},e.prototype.checkState=function(){if(!this.alive)throw new Error("Spica: Supervisor: Process "+this.namespace+"/"+this.process+" already exited.")},e}()}),define("src/lib/monad/lazy",["require","exports"],function(e,t){"use strict";var n=function(){function e(e){this.thunk=e}return e.prototype.evaluate=function(){return this.memory_=this.memory_||this.thunk()},e}();t.Lazy=n}),define("src/lib/monad/functor",["require","exports","src/lib/monad/lazy"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Lazy);t.Functor=r;var r;!function(e){function t(e,t){return t?e.fmap(t):function(t){return e.fmap(t)}}e.fmap=t}(r=t.Functor||(t.Functor={}))}),define("src/lib/monad/applicative",["require","exports","src/lib/monad/functor"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Functor);t.Applicative=r;var r;!function(e){function t(e,t){return t?e.bind(function(e){return t.fmap(function(t){return e(t)})}):function(t){return e.bind(function(e){return t.fmap(function(t){return e(t)})})}}e.ap=t}(r=t.Applicative||(t.Applicative={}))}),define("src/lib/monad/monad",["require","exports","src/lib/monad/applicative"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Applicative);t.Monad=r;var r;!function(e){function t(e,t){return t?e.bind(t):function(t){return e.bind(t)}}e.bind=t}(r=t.Monad||(t.Monad={}))}),define("src/lib/monad/monadplus",["require","exports","src/lib/monad/monad"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t}(n.Monad);t.MonadPlus=r;var r;!function(e){}(r=t.MonadPlus||(t.MonadPlus={}))}),define("src/lib/curry",["require","exports"],function(e,t){"use strict";function n(e,t,r){return e.length===t.length?e.apply(r,t):function(){for(var i=[],u=0;u<arguments.length;u++)i[u-0]=arguments[u];return n(e,t.concat(i),r)}}var r=this;t.curry=function(e,t){return void 0===t&&(t=r),0===e.length?function(){return e.call(t)}:n(e,[],t)}}),define("src/lib/monad/maybe.impl",["require","exports","src/lib/monad/monadplus"],function(e,t,n){"use strict";function r(){throw new Error("Spica: Maybe: Invalid thunk call.")}var i=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.fmap=function(e){return this.bind(function(t){return new u(e(t))})},t.prototype.bind=function(e){var n=this;return new t(function(){var r=n.evaluate();if(r instanceof u)return e(r.extract());if(r instanceof o)return r;if(r instanceof t)return r.bind(e);throw new TypeError("Spica: Maybe: Invalid monad value.\n\t"+r)})},t.prototype.extract=function(e){return this.evaluate().extract(e)},t}(n.MonadPlus);t.Maybe=i;var i;!function(e){function t(e){return new u(e)}e.pure=t,e.Return=t}(i=t.Maybe||(t.Maybe={}));var u=function(e){function t(t){e.call(this,r),this.a=t}return __extends(t,e),t.prototype.bind=function(e){var t=this;return new i(function(){return e(t.extract())})},t.prototype.extract=function(e){return this.a},t}(i);t.Just=u;var o=function(e){function t(){e.call(this,r)}return __extends(t,e),t.prototype.bind=function(e){return this},t.prototype.extract=function(e){if(!e)throw void 0;return e()},t}(i);t.Nothing=o;var i;!function(e){function t(t,n){return new e(function(){return t.fmap(function(){return t}).extract(function(){return n})})}e.mzero=new o,e.mplus=t}(i=t.Maybe||(t.Maybe={}))}),define("src/lib/monad/maybe",["require","exports","src/lib/monad/maybe.impl"],function(e,t,n){"use strict";var r;!function(e){function t(e){return new n.Just(e)}e.fmap=n.Maybe.fmap,e.pure=n.Maybe.pure,e.ap=n.Maybe.ap,e.Return=n.Maybe.Return,e.bind=n.Maybe.bind,e.mzero=n.Maybe.mzero,e.mplus=n.Maybe.mplus,e.Just=t,e.Nothing=n.Maybe.mzero}(r=t.Maybe||(t.Maybe={})),t.Just=r.Just,t.Nothing=r.Nothing,t.Return=r.Return}),define("src/lib/monad/either.impl",["require","exports","src/lib/monad/monad"],function(e,t,n){"use strict";function r(){throw new Error("Spica: Either: Invalid thunk call.")}var i=function(e){function t(t){e.call(this,t)}return __extends(t,e),t.prototype.fmap=function(e){return this.bind(function(t){return new o(e(t))})},t.prototype.bind=function(e){var n=this;return new t(function(){var r=n.evaluate();if(r instanceof u)return r;if(r instanceof o)return e(r.extract());if(r instanceof t)return r.bind(e);throw new TypeError("Spica: Either: Invalid monad value.\n\t"+r)})},t.prototype.extract=function(e){return this.evaluate().extract(e)},t}(n.Monad);t.Either=i;var i;!function(e){function t(e){return new o(e)}e.pure=t,e.Return=t}(i=t.Either||(t.Either={}));var u=function(e){function t(t){e.call(this,r),this.a=t}return __extends(t,e),t.prototype.bind=function(e){return this},t.prototype.extract=function(e){if(!e)throw this.a;return e(this.a)},t}(i);t.Left=u;var o=function(e){function t(t){e.call(this,r),this.b=t}return __extends(t,e),t.prototype.bind=function(e){var t=this;return new i(function(){return e(t.extract())})},t.prototype.extract=function(e){return this.b},t}(i);t.Right=o}),define("src/lib/monad/either",["require","exports","src/lib/monad/either.impl"],function(e,t,n){"use strict";var r;!function(e){function t(e){return new n.Left(e)}function r(e){return new n.Right(e)}e.fmap=n.Either.fmap,e.pure=n.Either.pure,e.ap=n.Either.ap,e.Return=n.Either.Return,e.bind=n.Either.bind,e.Left=t,e.Right=r}(r=t.Either||(t.Either={})),t.Left=r.Left,t.Right=r.Right,t.Return=r.Return}),define("src/lib/cancelable",["require","exports","src/lib/noop","src/lib/monad/maybe","src/lib/monad/either"],function(e,t,n,r,i){"use strict";var u=function(){function e(){var e=this;this.canceled=!1,this.promise=function(t){return e.canceled?e.promise_=e.promise_||new Promise(function(t,n){return void n(e.reason)}):Promise.resolve(t)},this.maybe=function(t){return e.canceled?r.Nothing:r.Just(t)},this.either=function(t){return e.canceled?i.Left(e.reason):i.Right(t)},this.cancel=function(t){return e.cancel=n.noop,e.canceled=!0,void(e.reason=t)}}return e}();t.Cancelable=u}),define("src/lib/monad/sequence/core",["require","exports","src/lib/monad/monadplus"],function(e,t,n){"use strict";var r=function(e){function t(t,n){e.call(this),this.cons=t,this.memory=n}return __extends(t,e),t}(n.MonadPlus);t.Sequence=r;var r;!function(e){}(r=t.Sequence||(t.Sequence={}));var r;!function(e){function t(e){return r.iterator(e)!==i.done}var n;!function(t){function n(t,n){switch(arguments.length){case 0:return[];case 1:return[t];case 2:return[t,n];default:throw e.Exception.invalidConsError(arguments)}}t.cons=n}(n=e.Data||(e.Data={}));var r;!function(e){function t(e){return e[0]}function n(e){return e[1]}function r(e){return e[2]}e.value=t,e.iterator=n,e.index=r}(r=e.Thunk||(e.Thunk={}));var i;!function(t){function n(t,i,u){return e.isIterable(t)?u(t,function(){return n(r.iterator(t)(),i,u)}):i(t)}t.done=function(){return[void 0,t.done,-1]},t.when=n}(i=e.Iterator||(e.Iterator={})),e.isIterable=t;var u;!function(e){function t(e){return console.error(e,e.length,e[0],e[1]),new TypeError("Spica: Sequence: Invalid parameters of cons.")}function n(e){return console.error(e),new TypeError("Spica: Sequence: Invalid data.")}function r(e){return console.error(e),new TypeError("Spica: Sequence: Invalid thunk.")}e.invalidConsError=t,e.invalidDataError=n,e.invalidThunkError=r}(u=e.Exception||(e.Exception={}))}(r=t.Sequence||(t.Sequence={}))}),define("src/lib/monad/sequence/member/static/from",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.from=function(e){return new n.Sequence(function(t,n){return void 0===t&&(t=0),t<e.length?n(e[t],++t):n()})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/write",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.write=function(e){return new n.Sequence(function(t,n){return e.length>0?n(e.shift(),e):n()})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/repeat",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.repeat=function(e){return new n.Sequence(function(t,n){return void 0===t&&(t=0),0===e.length?n():n(e[t],++t%e.length)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/random",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.random=function(e){switch(void 0===e&&(e=function(){return Math.random()}),!0){case Array.isArray(e):return this.random().map(function(t){return e[t*e.length|0]});default:return new n.Sequence(function(t,n){return n(e(),NaN)})}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/concat",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.concat=function(e){return new n.Sequence(function(t,r){var i=void 0===t?[function(){return e.iterate()},n.Sequence.Iterator.done]:t,u=i[0],o=i[1];return n.Sequence.Iterator.when(u(),function(){return r()},function(e,t){return o=o===n.Sequence.Iterator.done?function(){return n.Sequence.Thunk.value(e).iterate()}:o,n.Sequence.Iterator.when(o(),function(){return o=n.Sequence.Iterator.done,t()},function(t){return r(n.Sequence.Thunk.value(t),[function(){return e},n.Sequence.Thunk.iterator(t)])})})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/zip",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.zip=function(e,t){return new n.Sequence(function(r,i){var u=void 0===r?[function(){return e.iterate()},function(){return t.iterate()}]:r,o=u[0],c=u[1];return n.Sequence.Iterator.when(o(),function(){return i()},function(e){return n.Sequence.Iterator.when(c(),function(){return i()},function(t){return i([n.Sequence.Thunk.value(e),n.Sequence.Thunk.value(t)],[n.Sequence.Thunk.iterator(e),n.Sequence.Thunk.iterator(t)])})})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/union",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";function r(e,t,r){return new n.Sequence(function(i,u){var o=void 0===i?[function(){return t.iterate()},function(){return r.iterate()}]:i,c=o[0],s=o[1];return n.Sequence.Iterator.when(c(),function(){return n.Sequence.Iterator.when(s(),function(){return u()},function(e){return u(n.Sequence.Thunk.value(e),[n.Sequence.Iterator.done,n.Sequence.Thunk.iterator(e)])})},function(t){return n.Sequence.Iterator.when(s(),function(){return u(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),n.Sequence.Iterator.done])},function(r){var i=e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.value(r));return i<0?u(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),s]):i>0?u(n.Sequence.Thunk.value(r),[c,n.Sequence.Thunk.iterator(r)]):u(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),n.Sequence.Thunk.iterator(r)])})})})}var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.union=function(e,t){return t.reduce(function(t,n){return r(e,t,n)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/static/intersect",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";function r(e,t,r){return new n.Sequence(function(i,u){var o=void 0===i?[function(){return t.iterate()},function(){return r.iterate()}]:i,c=o[0],s=o[1];return n.Sequence.Iterator.when(c(),function(){return u()},function(t,r){return n.Sequence.Iterator.when(s(),function(){return u()},function(i,o){var c=e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.value(i));return c<0?(s=function(){return i},r()):c>0?o():u(n.Sequence.Thunk.value(t),[n.Sequence.Thunk.iterator(t),n.Sequence.Thunk.iterator(i)])})})})}var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.intersect=function(e,t){return t.reduce(function(t,n){return r(e,t,n)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/static/pure",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.pure=function(e){return new n.Sequence(function(t,n){return n(e)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/return",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.Return=function(e){return new n.Sequence(function(t,n){return n(e)})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mempty",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mempty=new n.Sequence(function(e,t){return t()}),t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mconcat",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";function r(e,t){return new n.Sequence(function(r,i){var u=void 0===r?[function(){return e.iterate()},function(){return t.iterate()}]:r,o=u[0],c=u[1];return n.Sequence.Iterator.when(o(),function(){return n.Sequence.Iterator.when(c(),function(){return i()},function(e){return i(n.Sequence.Thunk.value(e),[n.Sequence.Iterator.done,n.Sequence.Thunk.iterator(e)])})},function(e){return i(n.Sequence.Thunk.value(e),[n.Sequence.Thunk.iterator(e),c])})})}var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mconcat=function(e){return e.reduce(function(e,t){return r(e,t)},n.Sequence.from([]))},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/static/mappend",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mappend=function(e,t){return n.Sequence.mconcat([e,t])},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mzero",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mzero=n.Sequence.mempty,t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/static/mplus",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.mplus=n.Sequence.mappend,t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/iterate",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.iterate=function(){return this.iterate_()},t.prototype.iterate_=function(e,t){var r=this;void 0===t&&(t=0);var i=this.memory?this.memory.has(t)?this.memory.get(t):this.memory.set(t,this.cons(e,n.Sequence.Data.cons)).get(t):this.cons(e,n.Sequence.Data.cons);switch(i.length){case 0:return[void 0,n.Sequence.Iterator.done,-1];case 1:return[i[0],function(){return n.Sequence.Iterator.done()},t];case 2:return[i[0],function(){return r.iterate_(i[1],t+1)},t];default:throw n.Sequence.Exception.invalidDataError(i)}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/memoize",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.memoize=function(e){return void 0===e&&(e=this.memory||new Map),new n.Sequence(this.cons,this.memory||e)},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/read",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.read=function(){for(var e=this,t=[],i=function(){return e.iterate()};;){var u=i();if(!n.Sequence.isIterable(u))return t;void r.concat(t,[n.Sequence.Thunk.value(u)]),i=n.Sequence.Thunk.iterator(u)}},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/take",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.take=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(e>0?r():n.Sequence.Iterator.done(),function(){return i()},function(t){return n.Sequence.Thunk.index(t)+1<e?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):i(n.Sequence.Thunk.value(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/drop",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.drop=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return n.Sequence.Thunk.index(t)<e?r():i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/takeWhile",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.takeWhile=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t){return e(n.Sequence.Thunk.value(t))?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):i()})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/dropWhile",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.dropWhile=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t))?r():i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)); | ||
})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/takeUntil",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.takeUntil=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t){return e(n.Sequence.Thunk.value(t))?i(n.Sequence.Thunk.value(t)):i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/dropUntil",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.dropUntil=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t))?r():i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/fmap",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.fmap=function(e){var t=this;return new n.Sequence(function(r){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return n.Sequence.Data.cons()},function(t){return n.Sequence.Data.cons(e(n.Sequence.Thunk.value(t)),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/bind",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.bind=function(e){return n.Sequence.concat(this.fmap(e))},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/mapM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.mapM=function(e){var t=this;return this.take(1).bind(function(){var i=t.read();switch(i.length){case 0:return n.Sequence.from([]);default:var u=i.shift();return e(u).bind(function(t){return 0===i.length?n.Sequence.from([[t]]):n.Sequence.from(i).mapM(e).fmap(function(e){return r.concat([t],e)})})}})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/filterM",["require","exports","src/lib/monad/sequence/core","src/lib/concat"],function(e,t,n,r){"use strict";var i=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.filterM=function(e){var t=this;return this.take(1).bind(function(){var i=t.read();switch(i.length){case 0:return n.Sequence.from([[]]);default:var u=i.shift();return e(u).bind(function(t){return t?0===i.length?n.Sequence.from([[u]]):n.Sequence.from(i).filterM(e).fmap(function(e){return r.concat([u],e)}):0===i.length?n.Sequence.from([[]]):n.Sequence.from(i).filterM(e)})}})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=i}),define("src/lib/monad/sequence/member/instance/map",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.map=function(e){var t=this;return new n.Sequence(function(r){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return n.Sequence.Data.cons()},function(t){return n.Sequence.Data.cons(e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.index(t)),n.Sequence.Thunk.iterator(t))})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/filter",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.filter=function(e){var t=this;return new n.Sequence(function(r,i){return void 0===r&&(r=function(){return t.iterate()}),n.Sequence.Iterator.when(r(),function(){return i()},function(t,r){return e(n.Sequence.Thunk.value(t),n.Sequence.Thunk.index(t))?i(n.Sequence.Thunk.value(t),n.Sequence.Thunk.iterator(t)):r()})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/monad/sequence/member/instance/scan",["require","exports","src/lib/monad/sequence/core"],function(e,t,n){"use strict";var r=function(e){function t(){e.apply(this,arguments)}return __extends(t,e),t.prototype.scan=function(e,t){var r=this;return new n.Sequence(function(i){var u=void 0===i?[void 0,void 0]:i,o=u[0],c=void 0===o?t:o,s=u[1],a=void 0===s?function(){return r.iterate()}:s;return n.Sequence.Iterator.when(a(),function(){return n.Sequence.Data.cons()},function(t){return n.Sequence.Data.cons(c=e(c,n.Sequence.Thunk.value(t)),[c,n.Sequence.Thunk.iterator(t)])})})},t}(n.Sequence);Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r}),define("src/lib/assign",["require","exports","src/lib/type"],function(e,t,n){"use strict";function r(e){return function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];if(void 0===t||null===t)throw new TypeError("Spica: assign: Cannot walk on "+t+".");for(var i=0,u=n;i<u.length;i++){var o=u[i];if(void 0!==o&&null!==o)for(var c=0,s=Object.keys(Object(o));c<s.length;c++){var a=s[c],f=Object.getOwnPropertyDescriptor(Object(o),a);void 0!==f&&f.enumerable&&void e(a,Object(t),Object(o))}}return Object(t)}}t.assign=r(function(e,t,n){return t[e]=n[e]}),t.clone=r(function(e,r,i){switch(n.type(i[e])){case"Array":return r[e]=t.clone([],i[e]);case"Function":case"Object":return r[e]=t.clone({},i[e]);default:return r[e]=i[e]}}),t.extend=r(function(e,r,i){switch(n.type(i[e])){case"Array":return r[e]=t.extend([],i[e]);case"Function":case"Object":switch(n.type(r[e])){case"Function":case"Object":return r[e]=t.extend(r[e],i[e]);default:return r[e]=t.extend({},i[e])}default:return r[e]=i[e]}})}),define("src/lib/compose",["require","exports","src/lib/assign","src/lib/concat"],function(e,t,n,r){"use strict";function i(e){for(var t=[],i=1;i<arguments.length;i++)t[i-1]=arguments[i];return r.concat([e],t).reduce(function(e,t){void n.assign(e.prototype,t.prototype);for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);return e})}t.compose=i}),define("src/lib/monad/sequence",["require","exports","src/lib/monad/sequence/core","src/lib/monad/sequence/member/static/from","src/lib/monad/sequence/member/static/write","src/lib/monad/sequence/member/static/repeat","src/lib/monad/sequence/member/static/random","src/lib/monad/sequence/member/static/concat","src/lib/monad/sequence/member/static/zip","src/lib/monad/sequence/member/static/union","src/lib/monad/sequence/member/static/intersect","src/lib/monad/sequence/member/static/pure","src/lib/monad/sequence/member/static/return","src/lib/monad/sequence/member/static/mempty","src/lib/monad/sequence/member/static/mconcat","src/lib/monad/sequence/member/static/mappend","src/lib/monad/sequence/member/static/mzero","src/lib/monad/sequence/member/static/mplus","src/lib/monad/sequence/member/instance/iterate","src/lib/monad/sequence/member/instance/memoize","src/lib/monad/sequence/member/instance/read","src/lib/monad/sequence/member/instance/take","src/lib/monad/sequence/member/instance/drop","src/lib/monad/sequence/member/instance/takeWhile","src/lib/monad/sequence/member/instance/dropWhile","src/lib/monad/sequence/member/instance/takeUntil","src/lib/monad/sequence/member/instance/dropUntil","src/lib/monad/sequence/member/instance/fmap","src/lib/monad/sequence/member/instance/bind","src/lib/monad/sequence/member/instance/mapM","src/lib/monad/sequence/member/instance/filterM","src/lib/monad/sequence/member/instance/map","src/lib/monad/sequence/member/instance/filter","src/lib/monad/sequence/member/instance/scan","src/lib/compose"],function(e,t,n,r,i,u,o,c,s,a,f,d,l,p,h,v,m,b,q,y,S,x,_,w,g,k,M,T,O,I,j,P,R,E,D){"use strict";t.Sequence=n.Sequence,D.compose(n.Sequence,r["default"],i["default"],u["default"],o["default"],c["default"],s["default"],a["default"],f["default"],d["default"],l["default"],p["default"],h["default"],v["default"],m["default"],b["default"],q["default"],y["default"],S["default"],x["default"],_["default"],w["default"],g["default"],k["default"],M["default"],T["default"],O["default"],I["default"],j["default"],P["default"],R["default"],E["default"])}),define("src/lib/flip",["require","exports","src/lib/curry"],function(e,t,n){"use strict";function r(e){return n.curry(function(t,n){return e.length>1?e(n,t):e(n)(t)})}t.flip=r}),define("src/lib/collection/attrmap",["require","exports"],function(e,t){"use strict";var n=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,t){return this.store.get(e)&&this.store.get(e).get(t)},e.prototype.set=function(e,t,n){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new Map).get(e);return void r.set(t,n),this},e.prototype.has=function(e,t){return this.store.has(e)&&this.store.get(e).has(t)},e.prototype["delete"]=function(e,t){return void 0===t?this.store["delete"](e):!!this.store.has(e)&&this.store.get(e)["delete"](t)},e}();t.AttrMap=n}),define("src/lib/collection/relationmap",["require","exports"],function(e,t){"use strict";var n=function(){function e(){this.store=new WeakMap}return e.prototype.get=function(e,t){return this.store.get(e)&&this.store.get(e).get(t)},e.prototype.set=function(e,t,n){var r=this.store.has(e)?this.store.get(e):this.store.set(e,new WeakMap).get(e);return void r.set(t,n),this},e.prototype.has=function(e,t){return this.store.has(e)&&this.store.get(e).has(t)},e.prototype["delete"]=function(e,t){return void 0===t?this.store["delete"](e):!!this.store.has(e)&&this.store.get(e)["delete"](t)},e}();t.RelationMap=n}),define("src/lib/mixin",["require","exports","src/lib/assign"],function(e,t,n){"use strict";function r(){for(var e=[],t=0;t<arguments.length;t++)e[t-0]=arguments[t];return e.reduceRight(function(e,t){return i(t,e)},function(){function e(){}return e}())}function i(e,t){var r=function(){function n(){return e.apply(t.apply(this,arguments)||this,arguments)}return n}();void n.assign(r.prototype,e.prototype,t.prototype);for(var i in t)t.hasOwnProperty(i)&&(r[i]=t[i]);for(var i in e)e.hasOwnProperty(i)&&(r[i]=e[i]);return r}t.Mixin=r}),define("src/lib/fingerprint",["require","exports"],function(e,t){"use strict";function n(){return i(u([o(window.navigator),o(window.screen),o((new Date).getTimezoneOffset())].join()))}function r(){return i(u([o(process)].join()))}function i(e){return e.split("").reduce(function(e,t,n){return(+t*n+e)%1e9||e-+t},0)}function u(e){return e.split("").map(function(e){return e.charCodeAt(0)}).join("")}function o(e,t){if(void 0===t&&(t=5),t>0&&e&&"object"==typeof e){var n="{";for(var r in e)n+='"'+r+'": '+o(e[r],t-1)+",";return n+="}"}return!e||e.toString?'"'+e+'"':'"'+Object.prototype.toString.call(e)+'"'}t.FINGERPRINT="object"==typeof window?n():r(),t.browser=n,t.server=r,t.hash=i,t.str2digit=u,t.stringify=o}),define("src/lib/uuid",["require","exports","src/lib/fingerprint"],function(e,t,n){"use strict";function r(){var e=o=o*Date.now()%1e15;if(e<16||1e15<e)throw new Error("Spica: uuid: Invalid uuid dynamic seed.");for(var t="",n=0,r=u;n<r.length;n++){var i=r[n];if("x"===i||"y"===i){var c=Math.random()*e%16|0,s="x"==i?c:3&c|8;t+=s.toString(16)}else t+=i}return t.toLowerCase()}var i=n.FINGERPRINT*Date.now()%1e15;if(!i||"number"!=typeof i||i<100||1e15<i)throw new Error("Spica: uuid: Invalid uuid static seed.\n\t"+n.FINGERPRINT);var u=Object.freeze("xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split("")),o=i;t.v4=r}),define("src/lib/sort",["require","exports"],function(e,t){"use strict";function n(e,t,n,r){if(void 0===r&&(r=!1),!r&&n*n>1.25*e.length)return e.sort(t);n=n<e.length-1?n:e.length-1;for(var i=0;i<n;++i)for(var u=i+1;u<e.length;++u)if(t(e[i],e[u])>0!=!1){var o=e[i];e[i]=e[u],e[u]=o}return e}t.sort=n}),define("src/export",["require","exports","src/lib/supervisor","src/lib/observable","src/lib/cancelable","src/lib/monad/sequence","src/lib/monad/maybe","src/lib/monad/either","src/lib/curry","src/lib/flip","src/lib/collection/datamap","src/lib/collection/attrmap","src/lib/collection/relationmap","src/lib/mixin","src/lib/tick","src/lib/fingerprint","src/lib/uuid","src/lib/sqid","src/lib/assign","src/lib/concat","src/lib/sort"],function(e,t,n,r,i,u,o,c,s,a,f,d,l,p,h,v,m,b,q,y,S){"use strict";t.Supervisor=n.Supervisor,t.Observable=r.Observable,t.Cancelable=i.Cancelable,t.Sequence=u.Sequence,t.Maybe=o.Maybe,t.Just=o.Just,t.Nothing=o.Nothing,t.Either=c.Either,t.Left=c.Left,t.Right=c.Right,t.curry=s.curry,t.flip=a.flip,t.DataMap=f.DataMap,t.AttrMap=d.AttrMap,t.RelationMap=l.RelationMap,t.Mixin=p.Mixin,t.Tick=h.Tick,t.FINGERPRINT=v.FINGERPRINT,t.uuid=m.v4,t.sqid=b.sqid,t.assign=q.assign,t.clone=q.clone,t.extend=q.extend,t.concat=y.concat,t.sort=S.sort}),define("spica",["require","exports","src/export"],function(e,t,n){"use strict";function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}r(n)}); |
{ | ||
"name": "spica", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "Supervisor, Observable, Sequence, Maybe, Either and some utils.", | ||
@@ -47,3 +47,3 @@ "private": false, | ||
"gulp-unassert": "^1.0.0", | ||
"karma": "1.0.0", | ||
"karma": "^0.13.22", | ||
"karma-chrome-launcher": "^1.0.1", | ||
@@ -50,0 +50,0 @@ "karma-coverage": "^1.0.0", |
import {Functor} from './functor'; | ||
export abstract class Applicative<a> extends Functor<a> { | ||
public abstract fmap<b>(f: (a: a) => b): Applicative<b>; | ||
public abstract bind<b>(f: (a: a) => Applicative<b>): Applicative<b>; | ||
} | ||
export namespace Applicative { | ||
export declare function pure<a>(a: a): Applicative<a>; | ||
export declare function ap<a, b>(ff: Applicative<(a: a) => b>): (fa: Applicative<a>) => Applicative<b>; | ||
export function ap<_, b>(ff: Applicative<() => b>): () => Applicative<b>; | ||
export function ap<a, b>(ff: Applicative<(a: a) => b>, fa: Applicative<a>): Applicative<b>; | ||
export function ap<a, b>(ff: Applicative<(a: a) => b>): (fa: Applicative<a>) => Applicative<b>; | ||
export function ap<a, b>(ff: Applicative<(a: a) => b>, fa?: Applicative<a>): Applicative<b> | ((fa: Applicative<a>) => Applicative<b>) { | ||
return fa | ||
? ff.bind(f => fa.fmap(a => f(a))) | ||
: (fa: Applicative<a>) => ff.bind(f => fa.fmap(a => f(a))); | ||
} | ||
} |
@@ -33,13 +33,13 @@ import {Monad} from './monad'; | ||
export namespace Either { | ||
export declare function fmap<e, a, b>(m: Either<e, a>, f: (a: a) => b): Either<e, b> | ||
export declare function fmap<e, a>(m: Either<e, a>): <b>(f: (a: a) => b) => Either<e, b> | ||
export function pure<b>(b: b): Right<b> { | ||
return new Right(b); | ||
} | ||
export function ap<e, a, b>(ff: Either<e, () => b>): () => Either<e, b> | ||
export function ap<e, a, b>(ff: Either<e, (a: a) => b>): (fa: Either<e, a>) => Either<e, b> | ||
export function ap<e, a, b>(ff: Either<e, (a: a) => b>): (fa: Either<e, a>) => Either<e, b> { | ||
return (fa: Either<e, a>) => ff.bind(f => fa.fmap(a => f(a))); | ||
} | ||
export function Return<b>(b: b): Right<b> { | ||
return new Right(b); | ||
} | ||
export declare function ap<e, _, b>(ff: Either<e, () => b>): () => Either<e, b> | ||
export declare function ap<e, a, b>(ff: Either<e, (a: a) => b>, fa: Either<e, a>): Either<e, b> | ||
export declare function ap<e, a, b>(ff: Either<e, (a: a) => b>): (fa: Either<e, a>) => Either<e, b> | ||
export const Return = pure; | ||
export declare function bind<e, a, b>(m: Either<e, a>, f: (a: a) => Either<e, b>): Either<e, b> | ||
export declare function bind<e, a>(m: Either<e, a>): <b>(f: (a: a) => Either<e, b>) => Either<e, b> | ||
} | ||
@@ -49,2 +49,3 @@ | ||
protected EITHER: Left<a>; | ||
protected LEFT: a; | ||
constructor(private a: a) { | ||
@@ -68,2 +69,3 @@ super(throwCallError); | ||
protected EITHER: Right<b>; | ||
protected RIGHT: b; | ||
constructor(private b: b) { | ||
@@ -70,0 +72,0 @@ super(throwCallError); |
@@ -89,2 +89,7 @@ import {Return, Left, Right, Either} from './either'; | ||
describe('Functor', () => { | ||
it('fmap', () => { | ||
assert(Either.fmap(Return(0), n => n + 1).extract() === 1); | ||
assert(Either.fmap(Return(0))(n => n + 1).extract() === 1); | ||
}); | ||
it('Functor law 1', () => { | ||
@@ -149,2 +154,7 @@ const f = <T>(n: T) => n; | ||
describe('Monad', () => { | ||
it('bind', () => { | ||
assert(Either.bind(Return(0), n => Return(n + 1)).extract() === 1); | ||
assert(Either.bind(Return(0))(n => Return(n + 1)).extract() === 1); | ||
}); | ||
it('Monad law 1', () => { | ||
@@ -151,0 +161,0 @@ const f = (n: number) => Right(n + 1); |
import * as Monad from './either.impl'; | ||
export namespace Either { | ||
export const fmap = Monad.Either.fmap; | ||
export const pure = Monad.Either.pure; | ||
export const ap = Monad.Either.ap; | ||
export const Return = Monad.Either.Return; | ||
export const bind = Monad.Either.bind; | ||
export type Left<a> = Monad.Left<a>; | ||
@@ -8,0 +10,0 @@ export function Left<a>(a: a): Left<a> { |
@@ -6,1 +6,10 @@ import {Lazy} from './lazy'; | ||
} | ||
export namespace Functor { | ||
export function fmap<a, b>(m: Functor<a>, f: (a: a) => b): Functor<b>; | ||
export function fmap<a>(m: Functor<a>): <b>(f: (a: a) => b) => Functor<b>; | ||
export function fmap<a, b>(m: Functor<a>, f?: (a: a) => b): Functor<b> | ((f: (a: a) => b) => Functor<b>) { | ||
return f | ||
? m.fmap(f) | ||
: (f: (a: a) => b) => m.fmap(f); | ||
} | ||
} |
import {MonadPlus} from './monadplus'; | ||
import {curry} from '../curry'; | ||
@@ -33,13 +34,13 @@ export class Maybe<a> extends MonadPlus<a> { | ||
export namespace Maybe { | ||
export declare function fmap<a, b>(m: Maybe<a>, f: (a: a) => b): Maybe<b> | ||
export declare function fmap<a>(m: Maybe<a>): <b>(f: (a: a) => b) => Maybe<b> | ||
export function pure<a>(a: a): Maybe<a> { | ||
return new Just(a); | ||
} | ||
export function ap<a, b>(ff: Maybe<() => b>): () => Maybe<b> | ||
export function ap<a, b>(ff: Maybe<(a: a) => b>): (fa: Maybe<a>) => Maybe<b> | ||
export function ap<a, b>(ff: Maybe<(a: a) => b>): (fa: Maybe<a>) => Maybe<b> { | ||
return (fa: Maybe<a>) => ff.bind(f => fa.fmap(a => f(a))); | ||
} | ||
export function Return<a>(a: a): Maybe<a> { | ||
return new Just(a); | ||
} | ||
export declare function ap<_, b>(ff: Maybe<() => b>): () => Maybe<b> | ||
export declare function ap<a, b>(ff: Maybe<(a: a) => b>, fa: Maybe<a>): Maybe<b> | ||
export declare function ap<a, b>(ff: Maybe<(a: a) => b>): (fa: Maybe<a>) => Maybe<b> | ||
export const Return = pure; | ||
export declare function bind<a, b>(m: Maybe<a>, f: (a: a) => Maybe<b>): Maybe<b> | ||
export declare function bind<a>(m: Maybe<a>): <b>(f: (a: a) => Maybe<b>) => Maybe<b> | ||
} | ||
@@ -49,2 +50,3 @@ | ||
protected MAYBE: Just<a>; | ||
protected JUST: a; | ||
constructor(private a: a) { | ||
@@ -65,2 +67,3 @@ super(throwCallError); | ||
protected MAYBE: Nothing; | ||
protected NOTHING: void; | ||
constructor() { | ||
@@ -67,0 +70,0 @@ super(throwCallError); |
@@ -89,2 +89,7 @@ import {Return, Just, Nothing, Maybe} from './maybe'; | ||
describe('Functor', () => { | ||
it('fmap', () => { | ||
assert(Maybe.fmap(Return(0), n => n + 1).extract() === 1); | ||
assert(Maybe.fmap(Return(0))(n => n + 1).extract() === 1); | ||
}); | ||
it('Functor law 1', () => { | ||
@@ -149,2 +154,7 @@ const f = <T>(n: T) => n; | ||
describe('Monad', () => { | ||
it('bind', () => { | ||
assert(Maybe.bind(Return(0), n => Return(n + 1)).extract() === 1); | ||
assert(Maybe.bind(Return(0))(n => Return(n + 1)).extract() === 1); | ||
}); | ||
it('Monad law 1', () => { | ||
@@ -151,0 +161,0 @@ const f = (n: number) => Just(n + 1); |
import * as Monad from './maybe.impl'; | ||
export namespace Maybe { | ||
export const fmap = Monad.Maybe.fmap; | ||
export const pure = Monad.Maybe.pure; | ||
export const ap = Monad.Maybe.ap; | ||
export const Return = Monad.Maybe.Return; | ||
export const bind = Monad.Maybe.bind; | ||
export const mzero = Monad.Maybe.mzero; | ||
@@ -8,0 +10,0 @@ export const mplus = Monad.Maybe.mplus; |
@@ -8,2 +8,9 @@ import {Applicative} from './applicative'; | ||
export declare function Return<a>(a: a): Monad<a>; | ||
export function bind<a, b>(m: Monad<a>, f: (a: a) => Monad<b>): Monad<b>; | ||
export function bind<a>(m: Monad<a>): <b>(f: (a: a) => Monad<b>) => Monad<b>; | ||
export function bind<a, b>(m: Monad<a>, f?: (a: a) => Monad<b>): Monad<b> | (<b>(f: (a: a) => Monad<b>) => Monad<b>) { | ||
return f | ||
? m.bind(f) | ||
: (f: (a: a) => Monad<b>) => m.bind(f); | ||
} | ||
} |
import {Monad} from './monad'; | ||
export abstract class MonadPlus<a> extends Monad<a> { | ||
public static mzero: MonadPlus<any>; | ||
public static mplus: <a>(ml: MonadPlus<a>, mr: MonadPlus<a>) => MonadPlus<a>; | ||
} | ||
export namespace MonadPlus { | ||
export declare const mzero: MonadPlus<any>; | ||
export declare function mplus<a>(ml: MonadPlus<a>, mr: MonadPlus<a>): MonadPlus<a>; | ||
} |
@@ -30,2 +30,7 @@ import {Sequence} from './sequence'; | ||
describe('Functor', () => { | ||
it('fmap', () => { | ||
assert.deepStrictEqual(Sequence.fmap(Sequence.Return(0), n => n + 1).read(), [1]); | ||
assert.deepStrictEqual(Sequence.fmap(Sequence.Return(0))(n => n + 1).read(), [1]); | ||
}); | ||
it('Functor law 1', () => { | ||
@@ -58,2 +63,8 @@ const f = <T>(n: T) => n; | ||
[1]); | ||
assert.deepStrictEqual( | ||
Sequence.ap( | ||
Sequence.pure(curry((a: number) => a)), | ||
(Sequence.pure(1))) | ||
.read(), | ||
[1]); | ||
}); | ||
@@ -85,2 +96,7 @@ | ||
describe('Monad', () => { | ||
it('bind', () => { | ||
assert.deepStrictEqual(Sequence.bind(Sequence.Return(0), n => Sequence.Return(n + 1)).read(), [1]); | ||
assert.deepStrictEqual(Sequence.bind(Sequence.Return(0))(n => Sequence.Return(n + 1)).read(), [1]); | ||
}); | ||
it('Monad law 1', () => { | ||
@@ -87,0 +103,0 @@ const f = (n: number) => Sequence.Return(n + 1); |
import {Sequence} from './sequence/core'; | ||
import from from './sequence/member/static/from'; | ||
import write from './sequence/member/static/write'; | ||
import repeat from './sequence/member/static/repeat'; | ||
import random from './sequence/member/static/random'; | ||
@@ -10,3 +11,2 @@ import concat from './sequence/member/static/concat'; | ||
import pure from './sequence/member/static/pure'; | ||
import ap from './sequence/member/static/ap'; | ||
import Return from './sequence/member/static/return'; | ||
@@ -40,2 +40,3 @@ import mempty from './sequence/member/static/mempty'; | ||
write, | ||
repeat, | ||
random, | ||
@@ -47,3 +48,2 @@ concat, | ||
pure, | ||
ap, | ||
Return, | ||
@@ -50,0 +50,0 @@ mempty, |
@@ -14,2 +14,3 @@ import {MonadPlus} from '../monadplus'; | ||
export declare function write<a>(as: a[]): Sequence<a, a[]>; | ||
export declare function repeat<a>(as: a[]): Sequence<a, number>; | ||
export declare function random(): Sequence<number, number>; | ||
@@ -22,6 +23,11 @@ export declare function random<a>(gen: () => a): Sequence<a, number>; | ||
export declare function intersect<a>(cmp: (l: a, r: a) => number, as: Sequence<a, any>[]): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>; | ||
export declare function fmap<a, b>(m: Sequence<a, any>, f: (a: a) => b): Sequence<b, Sequence.Iterator<a>>; | ||
export declare function fmap<a>(m: Sequence<a, any>): <b>(f: (a: a) => b) => Sequence<b, Sequence.Iterator<a>>; | ||
export declare function pure<a>(a: a): Sequence<a, number>; | ||
export declare function ap<a, b>(ff: Sequence<() => b, any>): () => Sequence<() => b, [Sequence.Iterator<Sequence<b, any>>, Sequence.Iterator<b>]> | ||
export declare function ap<a, b>(ff: Sequence<(a: a) => b, any>, fa: Sequence<a, any>): Sequence<b, [Sequence.Iterator<Sequence<b, any>>, Sequence.Iterator<b>]> | ||
export declare function ap<a, b>(ff: Sequence<(a: a) => b, any>): (fa: Sequence<a, any>) => Sequence<b, [Sequence.Iterator<Sequence<b, any>>, Sequence.Iterator<b>]> | ||
export declare const Return: typeof pure; | ||
export declare function bind<a, b>(m: Sequence<a, any>, f: (a: a) => Sequence<b, any>): Sequence<b, Sequence.Iterator<a>>; | ||
export declare function bind<a>(m: Sequence<a, any>): <b>(f: (a: a) => Sequence<b, any>) => Sequence<b, Sequence.Iterator<a>>; | ||
export declare const mempty: Sequence<any, any>; | ||
@@ -28,0 +34,0 @@ export declare function mappend<a>(l: Sequence<a, any>, r: Sequence<a, any>): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>; |
@@ -5,4 +5,7 @@ import {Sequence} from '../../core'; | ||
public static from<a>(as: a[]): Sequence<a, number> { | ||
return new Sequence<a, number>((i = 0, cons) => i < as.length ? cons(as[i], ++i) : cons()); | ||
return new Sequence<a, number>((i = 0, cons) => | ||
i < as.length | ||
? cons(as[i], ++i) | ||
: cons()); | ||
} | ||
} |
@@ -80,2 +80,6 @@ /** | ||
} | ||
namespace Functor { | ||
export function fmap<a, b>(m: Functor<a>, f: (a: a) => b): Functor<b>; | ||
export function fmap<a>(m: Functor<a>): <b>(f: (a: a) => b) => Functor<b>; | ||
} | ||
export abstract class Applicative<a> extends Functor<a> { | ||
@@ -85,2 +89,4 @@ } | ||
export function pure<a>(a: a): Applicative<a>; | ||
export function ap<_, b>(ff: Applicative<() => b>): () => Applicative<b>; | ||
export function ap<a, b>(ff: Applicative<(a: a) => b>, fa: Applicative<a>): Applicative<b>; | ||
export function ap<a, b>(ff: Applicative<(a: a) => b>): (fa: Applicative<a>) => Applicative<b>; | ||
@@ -93,7 +99,11 @@ } | ||
export function Return<a>(a: a): Monad<a>; | ||
export function bind<a, b>(m: Monad<a>, f: (a: a) => Monad<b>): Monad<b>; | ||
export function bind<a>(m: Monad<a>): <b>(f: (a: a) => Monad<b>) => Monad<b>; | ||
} | ||
abstract class MonadPlus<a> extends Monad<a> { | ||
static mzero: MonadPlus<any>; | ||
static mplus<a>(ml: MonadPlus<a>, mr: MonadPlus<a>): MonadPlus<a>; | ||
} | ||
namespace MonadPlus { | ||
export const mzero: MonadPlus<any>; | ||
export function mplus<a>(ml: MonadPlus<a>, mr: MonadPlus<a>): MonadPlus<a>; | ||
} | ||
@@ -103,2 +113,3 @@ export class Sequence<a, z> extends MonadPlus<a> { | ||
static write<a>(as: a[]): Sequence<a, a[]>; | ||
static repeat<a>(as: a[]): Sequence<a, number>; | ||
static random(): Sequence<number, number>; | ||
@@ -111,6 +122,11 @@ static random<a>(gen: () => a): Sequence<a, number>; | ||
static intersect<a>(cmp: (l: a, r: a) => number, as: Sequence<a, any>[]): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>; | ||
static fmap<a, b>(m: Sequence<a, any>, f: (a: a) => b): Sequence<b, Sequence.Iterator<a>>; | ||
static fmap<a>(m: Sequence<a, any>): <b>(f: (a: a) => b) => Sequence<b, Sequence.Iterator<a>>; | ||
static pure<a>(a: a): Sequence<a, number>; | ||
static ap<a, b>(ff: Sequence<() => b, any>): () => Sequence<() => b, [Sequence.Iterator<Sequence<b, any>>, Sequence.Iterator<b>]> | ||
static ap<_, b>(ff: Sequence<() => b, any>): () => Sequence<() => b, [Sequence.Iterator<Sequence<b, any>>, Sequence.Iterator<b>]> | ||
static ap<a, b>(ff: Sequence<(a: a) => b, any>, fa: Sequence<a, any>): Sequence<b, [Sequence.Iterator<Sequence<b, any>>, Sequence.Iterator<b>]> | ||
static ap<a, b>(ff: Sequence<(a: a) => b, any>): (fa: Sequence<a, any>) => Sequence<b, [Sequence.Iterator<Sequence<b, any>>, Sequence.Iterator<b>]> | ||
static Return: typeof Sequence.pure; | ||
static bind<a, b>(m: Sequence<a, any>, f: (a: a) => Sequence<b, any>): Sequence<b, Sequence.Iterator<a>>; | ||
static bind<a>(m: Sequence<a, any>): <b>(f: (a: a) => Sequence<b, any>) => Sequence<b, Sequence.Iterator<a>>; | ||
static mempty: Sequence<any, any>; | ||
@@ -158,6 +174,11 @@ static mappend<a>(l: Sequence<a, any>, r: Sequence<a, any>): Sequence<a, [Sequence.Iterator<a>, Sequence.Iterator<a>]>; | ||
export namespace Maybe { | ||
export function fmap<a, b>(m: Maybe<a>, f: (a: a) => b): Maybe<b>; | ||
export function fmap<a>(m: Maybe<a>): <b>(f: (a: a) => b) => Maybe<b>; | ||
export function pure<a>(a: a): Maybe<a>; | ||
export function ap<a, b>(ff: Maybe<() => b>): () => Maybe<b>; | ||
export function ap<_, b>(ff: Maybe<() => b>): () => Maybe<b>; | ||
export function ap<a, b>(ff: Maybe<(a: a) => b>, fa: Maybe<a>): Maybe<b>; | ||
export function ap<a, b>(ff: Maybe<(a: a) => b>): (fa: Maybe<a>) => Maybe<b>; | ||
export const Return: typeof pure; | ||
export function bind<a, b>(m: Maybe<a>, f: (a: a) => Maybe<b>): Maybe<b>; | ||
export function bind<a>(m: Maybe<a>): <b>(f: (a: a) => Maybe<b>) => Maybe<b>; | ||
export const mzero: Maybe<any>; | ||
@@ -168,2 +189,3 @@ export function mplus<a>(ml: Maybe<a>, mr: Maybe<a>): Maybe<a>; | ||
protected MAYBE: Just<a>; | ||
protected JUST: a; | ||
bind<b>(f: (a: a) => Maybe<b>): Maybe<b>; | ||
@@ -175,2 +197,3 @@ extract(): a; | ||
protected MAYBE: Nothing; | ||
protected NOTHING: void; | ||
bind<b>(f: (a: any) => Maybe<b>): Maybe<b>; | ||
@@ -183,5 +206,7 @@ extract(): any; | ||
export namespace Maybe { | ||
export const fmap: typeof Monad.Maybe.fmap; | ||
export const pure: typeof Monad.Maybe.Maybe.pure; | ||
export const ap: typeof Monad.Maybe.Maybe.ap; | ||
export const Return: typeof Monad.Maybe.Maybe.Return; | ||
export const bind: typeof Monad.Maybe.Maybe.bind; | ||
export const mzero: typeof Monad.Maybe.Maybe.mzero; | ||
@@ -214,9 +239,15 @@ export const mplus: typeof Monad.Maybe.Maybe.mplus; | ||
export namespace Either { | ||
export function fmap<e, a, b>(m: Either<e, a>, f: (a: a) => b): Either<e, b>; | ||
export function fmap<e, a>(m: Either<e, a>): <b>(f: (a: a) => b) => Either<e, b>; | ||
export function pure<b>(b: b): Right<b>; | ||
export function ap<e, a, b>(ff: Either<e, () => b>): () => Either<e, b>; | ||
export function ap<e, _, b>(ff: Either<e, () => b>): () => Either<e, b>; | ||
export function ap<e, a, b>(ff: Either<e, (a: a) => b>, fa: Either<e, a>): Either<e, b>; | ||
export function ap<e, a, b>(ff: Either<e, (a: a) => b>): (fa: Either<e, a>) => Either<e, b>; | ||
export const Return: typeof pure; | ||
export function bind<e, a, b>(m: Either<e, a>, f: (a: a) => Either<e, b>): Either<e, b>; | ||
export function bind<e, a>(m: Either<e, a>): <b>(f: (a: a) => Either<e, b>) => Either<e, b>; | ||
} | ||
export class Left<a> extends Either<a, any> { | ||
protected EITHER: Left<a>; | ||
protected LEFT: a; | ||
bind<_ extends a>(f: (b: any) => Either<a, any>): Either<a, any>; | ||
@@ -229,2 +260,3 @@ bind<_ extends a, b>(f: (b: b) => Either<a, b>): Either<a, b>; | ||
protected EITHER: Right<b>; | ||
protected RIGHT: b; | ||
bind<a>(f: (b: b) => Either<a, b>): Either<a, b>; | ||
@@ -238,5 +270,7 @@ bind<a, c>(f: (b: b) => Either<a, c>): Either<a, c>; | ||
export namespace Either { | ||
export const fmap: typeof Monad.Either.fmap; | ||
export const pure: typeof Monad.Either.Either.pure; | ||
export const ap: typeof Monad.Either.Either.ap; | ||
export const Return: typeof Monad.Either.Either.Return; | ||
export const bind: typeof Monad.Either.Either.bind; | ||
export type Left<a> = Monad.Either.Left<a>; | ||
@@ -243,0 +277,0 @@ export function Left<a>(a: a): Left<a>; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
343668
127
8950