// This object will hold all exports.
var Haste = {};
if(typeof window === 'undefined') window = global;
/* Constructor functions for small ADTs. */
function T0(t){this._=t;}
function T1(t,a){this._=t;this.a=a;}
function T2(t,a,b){this._=t;this.a=a;this.b=b;}
function T3(t,a,b,c){this._=t;this.a=a;this.b=b;this.c=c;}
function T4(t,a,b,c,d){this._=t;this.a=a;this.b=b;this.c=c;this.d=d;}
function T5(t,a,b,c,d,e){this._=t;this.a=a;this.b=b;this.c=c;this.d=d;this.e=e;}
function T6(t,a,b,c,d,e,f){this._=t;this.a=a;this.b=b;this.c=c;this.d=d;this.e=e;this.f=f;}
/* Thunk
Creates a thunk representing the given closure.
If the non-updatable flag is undefined, the thunk is updatable.
*/
function T(f, nu) {
this.f = f;
if(nu === undefined) {
this.x = __updatable;
}
}
/* Hint to optimizer that an imported symbol is strict. */
function __strict(x) {return x}
// A tailcall.
function F(f) {
this.f = f;
}
// A partially applied function. Invariant: members are never thunks.
function PAP(f, args) {
this.f = f;
this.args = args;
this.arity = f.length - args.length;
}
// "Zero" object; used to avoid creating a whole bunch of new objects
// in the extremely common case of a nil-like data constructor.
var __Z = new T0(0);
// Special object used for blackholing.
var __blackhole = {};
// Used to indicate that an object is updatable.
var __updatable = {};
// Indicates that a closure-creating tail loop isn't done.
var __continue = {};
/* Generic apply.
Applies a function *or* a partial application object to a list of arguments.
See https://ghc.haskell.org/trac/ghc/wiki/Commentary/Rts/HaskellExecution/FunctionCalls
for more information.
*/
function A(f, args) {
while(true) {
f = E(f);
if(f instanceof Function) {
if(args.length === f.length) {
return f.apply(null, args);
} else if(args.length < f.length) {
return new PAP(f, args);
} else {
var f2 = f.apply(null, args.slice(0, f.length));
args = args.slice(f.length);
f = B(f2);
}
} else if(f instanceof PAP) {
if(args.length === f.arity) {
return f.f.apply(null, f.args.concat(args));
} else if(args.length < f.arity) {
return new PAP(f.f, f.args.concat(args));
} else {
var f2 = f.f.apply(null, f.args.concat(args.slice(0, f.arity)));
args = args.slice(f.arity);
f = B(f2);
}
} else {
return f;
}
}
}
function A1(f, x) {
f = E(f);
if(f instanceof Function) {
return f.length === 1 ? f(x) : new PAP(f, [x]);
} else if(f instanceof PAP) {
return f.arity === 1 ? f.f.apply(null, f.args.concat([x]))
: new PAP(f.f, f.args.concat([x]));
} else {
return f;
}
}
function A2(f, x, y) {
f = E(f);
if(f instanceof Function) {
switch(f.length) {
case 2: return f(x, y);
case 1: return A1(B(f(x)), y);
default: return new PAP(f, [x,y]);
}
} else if(f instanceof PAP) {
switch(f.arity) {
case 2: return f.f.apply(null, f.args.concat([x,y]));
case 1: return A1(B(f.f.apply(null, f.args.concat([x]))), y);
default: return new PAP(f.f, f.args.concat([x,y]));
}
} else {
return f;
}
}
function A3(f, x, y, z) {
f = E(f);
if(f instanceof Function) {
switch(f.length) {
case 3: return f(x, y, z);
case 2: return A1(B(f(x, y)), z);
case 1: return A2(B(f(x)), y, z);
default: return new PAP(f, [x,y,z]);
}
} else if(f instanceof PAP) {
switch(f.arity) {
case 3: return f.f.apply(null, f.args.concat([x,y,z]));
case 2: return A1(B(f.f.apply(null, f.args.concat([x,y]))), z);
case 1: return A2(B(f.f.apply(null, f.args.concat([x]))), y, z);
default: return new PAP(f.f, f.args.concat([x,y,z]));
}
} else {
return f;
}
}
/* Eval
Evaluate the given thunk t into head normal form.
If the "thunk" we get isn't actually a thunk, just return it.
*/
function E(t) {
if(t instanceof T) {
if(t.f !== __blackhole) {
if(t.x === __updatable) {
var f = t.f;
t.f = __blackhole;
t.x = f();
} else {
return t.f();
}
}
if(t.x === __updatable) {
throw 'Infinite loop!';
} else {
return t.x;
}
} else {
return t;
}
}
/* Tail call chain counter. */
var C = 0, Cs = [];
/* Bounce
Bounce on a trampoline for as long as we get a function back.
*/
function B(f) {
Cs.push(C);
while(f instanceof F) {
var fun = f.f;
f.f = __blackhole;
C = 0;
f = fun();
}
C = Cs.pop();
return f;
}
// Export Haste, A, B and E. Haste because we need to preserve exports, A, B
// and E because they're handy for Haste.Foreign.
if(!window) {
var window = {};
}
window['Haste'] = Haste;
window['A'] = A;
window['E'] = E;
window['B'] = B;
/* Throw an error.
We need to be able to use throw as an exception so we wrap it in a function.
*/
function die(err) {
throw E(err);
}
function quot(a, b) {
return (a-a%b)/b;
}
function quotRemI(a, b) {
return {_:0, a:(a-a%b)/b, b:a%b};
}
// 32 bit integer multiplication, with correct overflow behavior
// note that |0 or >>>0 needs to be applied to the result, for int and word
// respectively.
if(Math.imul) {
var imul = Math.imul;
} else {
var imul = function(a, b) {
// ignore high a * high a as the result will always be truncated
var lows = (a & 0xffff) * (b & 0xffff); // low a * low b
var aB = (a & 0xffff) * (b & 0xffff0000); // low a * high b
var bA = (a & 0xffff0000) * (b & 0xffff); // low b * high a
return lows + aB + bA; // sum will not exceed 52 bits, so it's safe
}
}
function addC(a, b) {
var x = a+b;
return {_:0, a:x & 0xffffffff, b:x > 0x7fffffff};
}
function subC(a, b) {
var x = a-b;
return {_:0, a:x & 0xffffffff, b:x < -2147483648};
}
function sinh (arg) {
return (Math.exp(arg) - Math.exp(-arg)) / 2;
}
function tanh (arg) {
return (Math.exp(arg) - Math.exp(-arg)) / (Math.exp(arg) + Math.exp(-arg));
}
function cosh (arg) {
return (Math.exp(arg) + Math.exp(-arg)) / 2;
}
function isFloatFinite(x) {
return isFinite(x);
}
function isDoubleFinite(x) {
return isFinite(x);
}
function err(str) {
die(toJSStr(str));
}
/* unpackCString#
NOTE: update constructor tags if the code generator starts munging them.
*/
function unCStr(str) {return unAppCStr(str, __Z);}
function unFoldrCStr(str, f, z) {
var acc = z;
for(var i = str.length-1; i >= 0; --i) {
acc = B(A(f, [str.charCodeAt(i), acc]));
}
return acc;
}
function unAppCStr(str, chrs) {
var i = arguments[2] ? arguments[2] : 0;
if(i >= str.length) {
return E(chrs);
} else {
return {_:1,a:str.charCodeAt(i),b:new T(function() {
return unAppCStr(str,chrs,i+1);
})};
}
}
function charCodeAt(str, i) {return str.charCodeAt(i);}
function fromJSStr(str) {
return unCStr(E(str));
}
function toJSStr(hsstr) {
var s = '';
for(var str = E(hsstr); str._ == 1; str = E(str.b)) {
s += String.fromCharCode(E(str.a));
}
return s;
}
// newMutVar
function nMV(val) {
return ({x: val});
}
// readMutVar
function rMV(mv) {
return mv.x;
}
// writeMutVar
function wMV(mv, val) {
mv.x = val;
}
// atomicModifyMutVar
function mMV(mv, f) {
var x = B(A(f, [mv.x]));
mv.x = x.a;
return x.b;
}
function localeEncoding() {
var le = newByteArr(5);
le['v']['i8'][0] = 'U'.charCodeAt(0);
le['v']['i8'][1] = 'T'.charCodeAt(0);
le['v']['i8'][2] = 'F'.charCodeAt(0);
le['v']['i8'][3] = '-'.charCodeAt(0);
le['v']['i8'][4] = '8'.charCodeAt(0);
return le;
}
var isDoubleNaN = isNaN;
var isFloatNaN = isNaN;
function isDoubleInfinite(d) {
return (d === Infinity);
}
var isFloatInfinite = isDoubleInfinite;
function isDoubleNegativeZero(x) {
return (x===0 && (1/x)===-Infinity);
}
var isFloatNegativeZero = isDoubleNegativeZero;
function strEq(a, b) {
return a == b;
}
function strOrd(a, b) {
if(a < b) {
return 0;
} else if(a == b) {
return 1;
}
return 2;
}
/* Convert a JS exception into a Haskell JSException */
function __hsException(e) {
e = e.toString();
var x = new Long(2904464383, 3929545892, true);
var y = new Long(3027541338, 3270546716, true);
var t = new T5(0, x, y
, new T5(0, x, y
, unCStr("haste-prim")
, unCStr("Haste.Prim.Foreign")
, unCStr("JSException")), __Z, __Z);
var show = function(x) {return unCStr(E(x).a);}
var dispEx = function(x) {return unCStr("JavaScript exception: " + E(x).a);}
var showList = function(_, s) {return unAppCStr(e, s);}
var showsPrec = function(_, _p, s) {return unAppCStr(e, s);}
var showDict = new T3(0, showsPrec, show, showList);
var self;
var fromEx = function(_) {return new T1(1, self);}
var dict = new T5(0, t, showDict, null /* toException */, fromEx, dispEx);
self = new T2(0, dict, new T1(0, e));
return self;
}
function jsCatch(act, handler) {
try {
return B(A(act,[0]));
} catch(e) {
if(typeof e._ === 'undefined') {
e = __hsException(e);
}
return B(A(handler,[e, 0]));
}
}
/* Haste represents constructors internally using 1 for the first constructor,
2 for the second, etc.
However, dataToTag should use 0, 1, 2, etc. Also, booleans might be unboxed.
*/
function dataToTag(x) {
if(x instanceof Object) {
return x._;
} else {
return x;
}
}
function __word_encodeDouble(d, e) {
return d * Math.pow(2,e);
}
var __word_encodeFloat = __word_encodeDouble;
var jsRound = Math.round, rintDouble = jsRound, rintFloat = jsRound;
var jsTrunc = Math.trunc ? Math.trunc : function(x) {
return x < 0 ? Math.ceil(x) : Math.floor(x);
};
function jsRoundW(n) {
return Math.abs(jsTrunc(n));
}
var realWorld = undefined;
if(typeof _ == 'undefined') {
var _ = undefined;
}
function popCnt64(i) {
return popCnt(i.low) + popCnt(i.high);
}
function popCnt(i) {
i = i - ((i >> 1) & 0x55555555);
i = (i & 0x33333333) + ((i >> 2) & 0x33333333);
return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24;
}
function __clz(bits, x) {
x &= (Math.pow(2, bits)-1);
if(x === 0) {
return bits;
} else {
return bits - (1 + Math.floor(Math.log(x)/Math.LN2));
}
}
// TODO: can probably be done much faster with arithmetic tricks like __clz
function __ctz(bits, x) {
var y = 1;
x &= (Math.pow(2, bits)-1);
if(x === 0) {
return bits;
}
for(var i = 0; i < bits; ++i) {
if(y & x) {
return i;
} else {
y <<= 1;
}
}
return 0;
}