Last active
December 14, 2015 20:59
-
-
Save puffnfresh/5148227 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package ; | |
// hots classes | |
using hots.ImplicitInstances; | |
using hots.ImplicitCasts; | |
// Javascript API | |
import js.JQuery; | |
import js.Lib; | |
import js.Browser.document; | |
// Import der Do-Syntax | |
import hots.Do; | |
// other classes | |
import scuts.core.Unit; | |
// Promises | |
import scuts.core.Promise; | |
using scuts.core.Promises; | |
class Animation | |
{ | |
// Bewegt das Element mit der Id "elemId" auf die neue Position (newX, newY). | |
// Der Animationsprozess wird von der Javascript Bibliothek JQuery durchgeführt. | |
// Diese Bewegung wird in Form eines asynchronen Prozess als Promise zurückgegeben. | |
public static function move (elemId:String, newX:Int, newY:Int):Promise<Unit> | |
{ | |
var p = new Promise(); | |
new JQuery("#" + elemId).animate( { left : newX, top:newY }, 1000, function () p.complete(Unit)); | |
return p; | |
} | |
// Skaliert das Element mit der Id "elemId" auf die neue Größe (newWidth, newHeight) | |
// Die Implementierung basiert wie auch "move" auf JQuery | |
public static function resize (elem:String, newWidth:Int, newHeight:Int):Promise<Unit> | |
{ | |
var p = new Promise(); | |
new JQuery("#" + elem).animate( { width : newWidth, height:newHeight }, 1000, function () p.complete(Unit)); | |
return p; | |
} | |
// Erzeugt einen Html Div-Container in Form einer Box mit den übergebenen Eigenschaften | |
public static function createBox (id:String, color:String, x:Int, y:Int, width:Int, height:Int) | |
{ | |
var elem = document.createElement("div"); | |
elem.id = id; | |
elem.style.backgroundColor = color; | |
elem.style.width = width + "px"; | |
elem.style.height = height + "px"; | |
elem.style.left = Std.string(x) + "px"; | |
elem.style.top = Std.string(y) + "px"; | |
elem.style.position = "absolute"; | |
return elem; | |
} | |
public static function main() | |
{ | |
// Referenz auf das Body Element des Html-Doms | |
var body = document.body; | |
// Erzeugen von vier unterschiedlichen Boxen und | |
// Einhängen dieser in den HTML-Dom | |
body.appendChild(createBox("redBox", "#FF0000", 0,0, 100, 100)); | |
body.appendChild(createBox("blueBox", "#0000FF", 0,100, 100, 100)); | |
body.appendChild(createBox("greenBox", "#00FF00", 100,0 , 100, 100)); | |
body.appendChild(createBox("cyanBox", "#00FFFF", 100,100 , 100, 100)); | |
// Der Animationsvorgang | |
var anim = Do.run( | |
move("cyanBox", 300, 300), | |
move("greenBox", 200, 10), | |
move("blueBox", 10,10).zip(move("greenBox", 20, 20)), | |
resize("redBox", 200, 200), | |
pure(Unit) | |
); | |
// sobald die Animation vollständig durchgeführt wurde, wird "animation complete" ausgegeben. | |
anim.onComplete(function (_) { trace("animation complete"); return null; }); | |
//anim.onCancelled(function () trace("animation cancelled")); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title>HOTS Animation</title> | |
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> | |
</head> | |
<body> | |
<script>(function () { "use strict"; | |
var $estr = function() { return js.Boot.__string_rec(this,''); }; | |
function $extend(from, fields) { | |
function inherit() {}; inherit.prototype = from; var proto = new inherit(); | |
for (var name in fields) proto[name] = fields[name]; | |
return proto; | |
} | |
var Animation = function() { } | |
Animation.__name__ = true; | |
Animation.move = function(elemId,newX,newY) { | |
var p = new scuts.core.Promise(); | |
new js.JQuery("#" + elemId).animate({ left : newX, top : newY},1000,function() { | |
p.complete(scuts.core.Unit.Unit); | |
}); | |
return p; | |
} | |
Animation.resize = function(elem,newWidth,newHeight) { | |
var p = new scuts.core.Promise(); | |
new js.JQuery("#" + elem).animate({ width : newWidth, height : newHeight},1000,function() { | |
p.complete(scuts.core.Unit.Unit); | |
}); | |
return p; | |
} | |
Animation.createBox = function(id,color,x,y,width,height) { | |
var elem = js.Browser.document.createElement("div"); | |
elem.id = id; | |
elem.style.backgroundColor = color; | |
elem.style.width = width + "px"; | |
elem.style.height = height + "px"; | |
elem.style.left = Std.string(x) + "px"; | |
elem.style.top = Std.string(y) + "px"; | |
elem.style.position = "absolute"; | |
return elem; | |
} | |
Animation.main = function() { | |
var body = js.Browser.document.body; | |
body.appendChild(Animation.createBox("redBox","#FF0000",0,0,100,100)); | |
body.appendChild(Animation.createBox("blueBox","#0000FF",0,100,100,100)); | |
body.appendChild(Animation.createBox("greenBox","#00FF00",100,0,100,100)); | |
body.appendChild(Animation.createBox("cyanBox","#00FFFF",100,100,100,100)); | |
var anim = (function($this) { | |
var $r; | |
var ___monad = hots.InstMonad.promiseMonad; | |
$r = hots.InstMonad.promiseMonad.flatMap(Animation.move("cyanBox",300,300),function(_) { | |
return hots.InstMonad.promiseMonad.flatMap(Animation.move("greenBox",200,10),function(_1) { | |
return hots.InstMonad.promiseMonad.flatMap(scuts.core.Promises.zip(Animation.move("blueBox",10,10),Animation.move("greenBox",20,20)),function(_2) { | |
return hots.InstMonad.promiseMonad.map(Animation.resize("redBox",200,200),function(_3) { | |
return scuts.core.Unit.Unit; | |
}); | |
}); | |
}); | |
}); | |
return $r; | |
}(this)); | |
anim.onComplete(function(_) { | |
console.log("animation complete"); | |
return null; | |
}); | |
} | |
var EReg = function(r,opt) { | |
opt = opt.split("u").join(""); | |
this.r = new RegExp(r,opt); | |
}; | |
EReg.__name__ = true; | |
EReg.prototype = { | |
replace: function(s,by) { | |
return s.replace(this.r,by); | |
} | |
,split: function(s) { | |
var d = "#__delim__#"; | |
return s.replace(this.r,d).split(d); | |
} | |
} | |
var HxOverrides = function() { } | |
HxOverrides.__name__ = true; | |
HxOverrides.cca = function(s,index) { | |
var x = s.charCodeAt(index); | |
if(x != x) return undefined; | |
return x; | |
} | |
HxOverrides.substr = function(s,pos,len) { | |
if(pos != null && pos != 0 && len != null && len < 0) return ""; | |
if(len == null) len = s.length; | |
if(pos < 0) { | |
pos = s.length + pos; | |
if(pos < 0) pos = 0; | |
} else if(len < 0) len = s.length + len - pos; | |
return s.substr(pos,len); | |
} | |
HxOverrides.iter = function(a) { | |
return { cur : 0, arr : a, hasNext : function() { | |
return this.cur < this.arr.length; | |
}, next : function() { | |
return this.arr[this.cur++]; | |
}}; | |
} | |
var Reflect = function() { } | |
Reflect.__name__ = true; | |
Reflect.isObject = function(v) { | |
if(v == null) return false; | |
var t = typeof(v); | |
return t == "string" || t == "object" && !v.__enum__ || t == "function" && (v.__name__ || v.__ename__); | |
} | |
var Std = function() { } | |
Std.__name__ = true; | |
Std.string = function(s) { | |
return js.Boot.__string_rec(s,""); | |
} | |
Std.parseInt = function(x) { | |
var v = parseInt(x,10); | |
if(v == 0 && (HxOverrides.cca(x,1) == 120 || HxOverrides.cca(x,1) == 88)) v = parseInt(x); | |
if(isNaN(v)) return null; | |
return v; | |
} | |
Std.parseFloat = function(x) { | |
return parseFloat(x); | |
} | |
var StringBuf = function() { | |
this.b = ""; | |
}; | |
StringBuf.__name__ = true; | |
var StringTools = function() { } | |
StringTools.__name__ = true; | |
StringTools.startsWith = function(s,start) { | |
return s.length >= start.length && HxOverrides.substr(s,0,start.length) == start; | |
} | |
StringTools.endsWith = function(s,end) { | |
var elen = end.length; | |
var slen = s.length; | |
return slen >= elen && HxOverrides.substr(s,slen - elen,elen) == end; | |
} | |
StringTools.isSpace = function(s,pos) { | |
var c = HxOverrides.cca(s,pos); | |
return c > 8 && c < 14 || c == 32; | |
} | |
StringTools.ltrim = function(s) { | |
var l = s.length; | |
var r = 0; | |
while(r < l && StringTools.isSpace(s,r)) r++; | |
if(r > 0) return HxOverrides.substr(s,r,l - r); else return s; | |
} | |
StringTools.rtrim = function(s) { | |
var l = s.length; | |
var r = 0; | |
while(r < l && StringTools.isSpace(s,l - r - 1)) r++; | |
if(r > 0) return HxOverrides.substr(s,0,l - r); else return s; | |
} | |
StringTools.trim = function(s) { | |
return StringTools.ltrim(StringTools.rtrim(s)); | |
} | |
StringTools.lpad = function(s,c,l) { | |
if(c.length <= 0) return s; | |
while(s.length < l) s = c + s; | |
return s; | |
} | |
StringTools.rpad = function(s,c,l) { | |
if(c.length <= 0) return s; | |
while(s.length < l) s = s + c; | |
return s; | |
} | |
StringTools.replace = function(s,sub,by) { | |
return s.split(sub).join(by); | |
} | |
var X_hots_gen_casts_Casts_1a44b15abb95f1aa59fdec1caa371c0f = function() { } | |
X_hots_gen_casts_Casts_1a44b15abb95f1aa59fdec1caa371c0f.__name__ = true; | |
X_hots_gen_casts_Casts_1a44b15abb95f1aa59fdec1caa371c0f.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_1a44b15abb95f1aa59fdec1caa371c0f.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_23caf15e76e9f38b7a767e20ed363652 = function() { } | |
X_hots_gen_casts_Casts_23caf15e76e9f38b7a767e20ed363652.__name__ = true; | |
X_hots_gen_casts_Casts_23caf15e76e9f38b7a767e20ed363652.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_23caf15e76e9f38b7a767e20ed363652.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_25218e0200bf2743d79950299b20b60a = function() { } | |
X_hots_gen_casts_Casts_25218e0200bf2743d79950299b20b60a.__name__ = true; | |
X_hots_gen_casts_Casts_25218e0200bf2743d79950299b20b60a.implicitUpcastT = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_25218e0200bf2743d79950299b20b60a.implicitDowncastT = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_2663f2d08de3a5bb8c6df77eaedc36bf = function() { } | |
X_hots_gen_casts_Casts_2663f2d08de3a5bb8c6df77eaedc36bf.__name__ = true; | |
X_hots_gen_casts_Casts_2663f2d08de3a5bb8c6df77eaedc36bf.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_2663f2d08de3a5bb8c6df77eaedc36bf.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_266420e0fa15b4620ff76cb3ec98e299 = function() { } | |
X_hots_gen_casts_Casts_266420e0fa15b4620ff76cb3ec98e299.__name__ = true; | |
X_hots_gen_casts_Casts_266420e0fa15b4620ff76cb3ec98e299.implicitUpcastT = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_266420e0fa15b4620ff76cb3ec98e299.implicitDowncastT = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_3094650595e932ee706e1a86c1267761 = function() { } | |
X_hots_gen_casts_Casts_3094650595e932ee706e1a86c1267761.__name__ = true; | |
X_hots_gen_casts_Casts_3094650595e932ee706e1a86c1267761.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_3094650595e932ee706e1a86c1267761.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_33809b8a7f20f0be127e3a9b419849d4 = function() { } | |
X_hots_gen_casts_Casts_33809b8a7f20f0be127e3a9b419849d4.__name__ = true; | |
X_hots_gen_casts_Casts_33809b8a7f20f0be127e3a9b419849d4.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_33809b8a7f20f0be127e3a9b419849d4.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_347888b35121b0d5e97e6ac2419eca8d = function() { } | |
X_hots_gen_casts_Casts_347888b35121b0d5e97e6ac2419eca8d.__name__ = true; | |
X_hots_gen_casts_Casts_347888b35121b0d5e97e6ac2419eca8d.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_347888b35121b0d5e97e6ac2419eca8d.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_3cf593dbfcd204f1f1ed386fc5a7602a = function() { } | |
X_hots_gen_casts_Casts_3cf593dbfcd204f1f1ed386fc5a7602a.__name__ = true; | |
X_hots_gen_casts_Casts_3cf593dbfcd204f1f1ed386fc5a7602a.implicitUpcastT = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_3cf593dbfcd204f1f1ed386fc5a7602a.implicitDowncastT = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_571541ae9e6ae7213a21e4aa50bf8895 = function() { } | |
X_hots_gen_casts_Casts_571541ae9e6ae7213a21e4aa50bf8895.__name__ = true; | |
X_hots_gen_casts_Casts_571541ae9e6ae7213a21e4aa50bf8895.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_571541ae9e6ae7213a21e4aa50bf8895.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_6287a2da0b6250a347160b999f95a197 = function() { } | |
X_hots_gen_casts_Casts_6287a2da0b6250a347160b999f95a197.__name__ = true; | |
X_hots_gen_casts_Casts_6287a2da0b6250a347160b999f95a197.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_6287a2da0b6250a347160b999f95a197.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_71e9cb200a0c959e4f2fc14195912458 = function() { } | |
X_hots_gen_casts_Casts_71e9cb200a0c959e4f2fc14195912458.__name__ = true; | |
X_hots_gen_casts_Casts_71e9cb200a0c959e4f2fc14195912458.implicitUpcastT = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_71e9cb200a0c959e4f2fc14195912458.implicitDowncastT = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_8822e4b65748248ecdb568bf0fd412ab = function() { } | |
X_hots_gen_casts_Casts_8822e4b65748248ecdb568bf0fd412ab.__name__ = true; | |
X_hots_gen_casts_Casts_8822e4b65748248ecdb568bf0fd412ab.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_8822e4b65748248ecdb568bf0fd412ab.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_8ae6a1b0e850e7cc944f0d40246cd72a = function() { } | |
X_hots_gen_casts_Casts_8ae6a1b0e850e7cc944f0d40246cd72a.__name__ = true; | |
X_hots_gen_casts_Casts_8ae6a1b0e850e7cc944f0d40246cd72a.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_8ae6a1b0e850e7cc944f0d40246cd72a.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_923811a849f60c360a109f0d5f8dd2f3 = function() { } | |
X_hots_gen_casts_Casts_923811a849f60c360a109f0d5f8dd2f3.__name__ = true; | |
X_hots_gen_casts_Casts_923811a849f60c360a109f0d5f8dd2f3.implicitUpcastT = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_923811a849f60c360a109f0d5f8dd2f3.implicitDowncastT = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_92b6d75e5989017a88e61876e0d59c84 = function() { } | |
X_hots_gen_casts_Casts_92b6d75e5989017a88e61876e0d59c84.__name__ = true; | |
X_hots_gen_casts_Casts_92b6d75e5989017a88e61876e0d59c84.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_92b6d75e5989017a88e61876e0d59c84.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_a3ab46d216b9f025ad60b758eb2f1fac = function() { } | |
X_hots_gen_casts_Casts_a3ab46d216b9f025ad60b758eb2f1fac.__name__ = true; | |
X_hots_gen_casts_Casts_a3ab46d216b9f025ad60b758eb2f1fac.implicitUpcastT = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_a3ab46d216b9f025ad60b758eb2f1fac.implicitDowncastT = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_a6c5675c85fbbcdb2f67a4cb2e2dd04e = function() { } | |
X_hots_gen_casts_Casts_a6c5675c85fbbcdb2f67a4cb2e2dd04e.__name__ = true; | |
X_hots_gen_casts_Casts_a6c5675c85fbbcdb2f67a4cb2e2dd04e.implicitUpcastT = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_a6c5675c85fbbcdb2f67a4cb2e2dd04e.implicitDowncastT = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_ab29f2be3f5f4d8f32c11a731f36a028 = function() { } | |
X_hots_gen_casts_Casts_ab29f2be3f5f4d8f32c11a731f36a028.__name__ = true; | |
X_hots_gen_casts_Casts_ab29f2be3f5f4d8f32c11a731f36a028.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_ab29f2be3f5f4d8f32c11a731f36a028.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_c2108951231127b96f039bf8617877d2 = function() { } | |
X_hots_gen_casts_Casts_c2108951231127b96f039bf8617877d2.__name__ = true; | |
X_hots_gen_casts_Casts_c2108951231127b96f039bf8617877d2.implicitUpcastT = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_c2108951231127b96f039bf8617877d2.implicitDowncastT = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_d35a62c827ce1130e70be32436184fcc = function() { } | |
X_hots_gen_casts_Casts_d35a62c827ce1130e70be32436184fcc.__name__ = true; | |
X_hots_gen_casts_Casts_d35a62c827ce1130e70be32436184fcc.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_d35a62c827ce1130e70be32436184fcc.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_eee066e24042b9aa274392939331ec93 = function() { } | |
X_hots_gen_casts_Casts_eee066e24042b9aa274392939331ec93.__name__ = true; | |
X_hots_gen_casts_Casts_eee066e24042b9aa274392939331ec93.implicitUpcastT = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_eee066e24042b9aa274392939331ec93.implicitDowncastT = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_eee2fa73dacf0aa733c86831d9472b08 = function() { } | |
X_hots_gen_casts_Casts_eee2fa73dacf0aa733c86831d9472b08.__name__ = true; | |
X_hots_gen_casts_Casts_eee2fa73dacf0aa733c86831d9472b08.implicitUpcast = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_eee2fa73dacf0aa733c86831d9472b08.implicitDowncast = function(x) { | |
return x; | |
} | |
var X_hots_gen_casts_Casts_f9f6099e454b18dbf45ed2fe924d61b9 = function() { } | |
X_hots_gen_casts_Casts_f9f6099e454b18dbf45ed2fe924d61b9.__name__ = true; | |
X_hots_gen_casts_Casts_f9f6099e454b18dbf45ed2fe924d61b9.implicitUpcastT = function(x) { | |
return x; | |
} | |
X_hots_gen_casts_Casts_f9f6099e454b18dbf45ed2fe924d61b9.implicitDowncastT = function(x) { | |
return x; | |
} | |
var haxe = {} | |
haxe.ds = {} | |
haxe.ds.IntMap = function() { | |
this.h = { }; | |
}; | |
haxe.ds.IntMap.__name__ = true; | |
haxe.ds.IntMap.prototype = { | |
set: function(key,value) { | |
this.h[key] = value; | |
} | |
} | |
var hots = {} | |
hots.Do = function() { } | |
hots.Do.__name__ = true; | |
hots.Hots = function() { } | |
hots.Hots.__name__ = true; | |
hots.Identity = function() { } | |
hots.Identity.__name__ = true; | |
hots.classes = {} | |
hots.classes.Eq = function() { } | |
hots.classes.Eq.__name__ = true; | |
hots.classes.EqAbstract = function() { } | |
hots.classes.EqAbstract.__name__ = true; | |
hots.classes.EqAbstract.__interfaces__ = [hots.classes.Eq]; | |
hots.classes.EqAbstract.prototype = { | |
notEq: function(a,b) { | |
return !this.eq(a,b); | |
} | |
,eq: function(a,b) { | |
return !this.notEq(a,b); | |
} | |
} | |
hots.instances = {} | |
hots.instances.BoolEq = function() { | |
}; | |
hots.instances.BoolEq.__name__ = true; | |
hots.instances.BoolEq.__super__ = hots.classes.EqAbstract; | |
hots.instances.BoolEq.prototype = $extend(hots.classes.EqAbstract.prototype,{ | |
eq: function(a,b) { | |
return a == b; | |
} | |
}); | |
hots.instances.DateEq = function(floatEq) { | |
this.floatEq = floatEq; | |
}; | |
hots.instances.DateEq.__name__ = true; | |
hots.instances.DateEq.__super__ = hots.classes.EqAbstract; | |
hots.instances.DateEq.prototype = $extend(hots.classes.EqAbstract.prototype,{ | |
eq: function(a,b) { | |
return this.floatEq.eq(a.getTime(),b.getTime()); | |
} | |
}); | |
hots.instances.FloatEq = function() { | |
}; | |
hots.instances.FloatEq.__name__ = true; | |
hots.instances.FloatEq.__super__ = hots.classes.EqAbstract; | |
hots.instances.FloatEq.prototype = $extend(hots.classes.EqAbstract.prototype,{ | |
eq: function(a,b) { | |
return scuts.core.Floats.eq(a,b); | |
} | |
}); | |
hots.instances.IntEq = function() { | |
}; | |
hots.instances.IntEq.__name__ = true; | |
hots.instances.IntEq.__super__ = hots.classes.EqAbstract; | |
hots.instances.IntEq.prototype = $extend(hots.classes.EqAbstract.prototype,{ | |
eq: function(a,b) { | |
return a == b; | |
} | |
}); | |
hots.instances.StringEq = function() { | |
}; | |
hots.instances.StringEq.__name__ = true; | |
hots.instances.StringEq.__super__ = hots.classes.EqAbstract; | |
hots.instances.StringEq.prototype = $extend(hots.classes.EqAbstract.prototype,{ | |
eq: function(a,b) { | |
return a == b; | |
} | |
}); | |
hots.InstEq = function() { } | |
hots.InstEq.__name__ = true; | |
hots.InstEq.eitherEq = function(eq1,eq2) { | |
return new hots.instances.EitherEq(eq1,eq2); | |
} | |
hots.InstEq.tup2Eq = function(eq1,eq2) { | |
return new hots.instances.Tup2Eq(eq1,eq2); | |
} | |
hots.InstEq.tup3Eq = function(eq1,eq2,eq3) { | |
var eq = function(a,b) { | |
return eq1.eq(a._1,b._1) && eq2.eq(a._2,b._2) && eq3.eq(a._3,b._3); | |
}; | |
return hots.extensions.Eqs.create(eq); | |
} | |
hots.InstEq.optionEq = function(eqT) { | |
return new hots.instances.OptionEq(eqT); | |
} | |
hots.InstEq.arrayEq = function(eqT) { | |
return new hots.instances.ArrayEq(eqT); | |
} | |
hots.InstEq.validationEq = function(eqF,eqS) { | |
return new hots.instances.ValidationEq(eqF,eqS); | |
} | |
hots.classes.Ord = function() { } | |
hots.classes.Ord.__name__ = true; | |
hots.classes.Ord.__interfaces__ = [hots.classes.Eq]; | |
hots.classes.OrdAbstract = function(eqT) { | |
this.eqT = eqT; | |
}; | |
hots.classes.OrdAbstract.__name__ = true; | |
hots.classes.OrdAbstract.__interfaces__ = [hots.classes.Ord]; | |
hots.classes.OrdAbstract.prototype = { | |
notEq: function(a,b) { | |
return this.eqT.notEq(a,b); | |
} | |
,eq: function(a,b) { | |
return this.eqT.eq(a,b); | |
} | |
,max: function(a,b) { | |
return this.greaterOrEq(a,b)?a:b; | |
} | |
,min: function(a,b) { | |
return this.lessOrEq(a,b)?a:b; | |
} | |
,greater: function(a,b) { | |
return this.compare(a,b) == scuts.core.Ordering.GT; | |
} | |
,greaterOrEq: function(a,b) { | |
return this.compare(a,b) != scuts.core.Ordering.LT; | |
} | |
,lessOrEq: function(a,b) { | |
return this.compare(a,b) != scuts.core.Ordering.GT; | |
} | |
,less: function(a,b) { | |
return this.compare(a,b) == scuts.core.Ordering.LT; | |
} | |
,compareInt: function(a,b) { | |
return this.eqT.eq(a,b)?0:this.lessOrEq(a,b)?-1:1; | |
} | |
,compare: function(a,b) { | |
return this.eqT.eq(a,b)?scuts.core.Ordering.EQ:this.lessOrEq(a,b)?scuts.core.Ordering.LT:scuts.core.Ordering.GT; | |
} | |
} | |
hots.instances.BoolOrd = function(eq) { | |
hots.classes.OrdAbstract.call(this,eq); | |
}; | |
hots.instances.BoolOrd.__name__ = true; | |
hots.instances.BoolOrd.__super__ = hots.classes.OrdAbstract; | |
hots.instances.BoolOrd.prototype = $extend(hots.classes.OrdAbstract.prototype,{ | |
max: function(a,b) { | |
return a?a:b; | |
} | |
,min: function(a,b) { | |
return !a?a:b; | |
} | |
,less: function(a,b) { | |
return !a && b; | |
} | |
}); | |
hots.instances.DateOrd = function(eq,floatOrd) { | |
hots.classes.OrdAbstract.call(this,eq); | |
this.floatOrd = floatOrd; | |
}; | |
hots.instances.DateOrd.__name__ = true; | |
hots.instances.DateOrd.__super__ = hots.classes.OrdAbstract; | |
hots.instances.DateOrd.prototype = $extend(hots.classes.OrdAbstract.prototype,{ | |
compareInt: function(a,b) { | |
return this.floatOrd.compareInt(a.getTime(),b.getTime()); | |
} | |
,compare: function(a,b) { | |
return this.floatOrd.compare(a.getTime(),b.getTime()); | |
} | |
,less: function(a,b) { | |
return this.floatOrd.less(a.getTime(),b.getTime()); | |
} | |
}); | |
hots.instances.FloatOrd = function(eq) { | |
hots.classes.OrdAbstract.call(this,eq); | |
}; | |
hots.instances.FloatOrd.__name__ = true; | |
hots.instances.FloatOrd.__super__ = hots.classes.OrdAbstract; | |
hots.instances.FloatOrd.prototype = $extend(hots.classes.OrdAbstract.prototype,{ | |
compareInt: function(a,b) { | |
return a < b?-1:a > b?1:0; | |
} | |
,compare: function(a,b) { | |
return a < b?scuts.core.Ordering.LT:a > b?scuts.core.Ordering.GT:scuts.core.Ordering.EQ; | |
} | |
,max: function(a,b) { | |
return a > b?a:b; | |
} | |
,min: function(a,b) { | |
return a < b?a:b; | |
} | |
,greaterOrEq: function(a,b) { | |
return a >= b; | |
} | |
,greater: function(a,b) { | |
return a > b; | |
} | |
,less: function(a,b) { | |
return a < b; | |
} | |
,lessOrEq: function(a,b) { | |
return a <= b; | |
} | |
}); | |
hots.instances.IntOrd = function(eq) { | |
hots.classes.OrdAbstract.call(this,eq); | |
}; | |
hots.instances.IntOrd.__name__ = true; | |
hots.instances.IntOrd.__super__ = hots.classes.OrdAbstract; | |
hots.instances.IntOrd.prototype = $extend(hots.classes.OrdAbstract.prototype,{ | |
compareInt: function(a,b) { | |
return a < b?-1:a > b?1:0; | |
} | |
,compare: function(a,b) { | |
return a < b?scuts.core.Ordering.LT:a > b?scuts.core.Ordering.GT:scuts.core.Ordering.EQ; | |
} | |
,max: function(a,b) { | |
return a > b?a:b; | |
} | |
,min: function(a,b) { | |
return a < b?a:b; | |
} | |
,greaterOrEq: function(a,b) { | |
return a >= b; | |
} | |
,greater: function(a,b) { | |
return a > b; | |
} | |
,less: function(a,b) { | |
return a < b; | |
} | |
,lessOrEq: function(a,b) { | |
return a <= b; | |
} | |
}); | |
hots.instances.StringOrd = function(eq) { | |
hots.classes.OrdAbstract.call(this,eq); | |
}; | |
hots.instances.StringOrd.__name__ = true; | |
hots.instances.StringOrd.__super__ = hots.classes.OrdAbstract; | |
hots.instances.StringOrd.prototype = $extend(hots.classes.OrdAbstract.prototype,{ | |
lessOrEq: function(a,b) { | |
return a <= b; | |
} | |
}); | |
hots.InstOrd = function() { } | |
hots.InstOrd.__name__ = true; | |
hots.InstOrd.optionOrd = function(a) { | |
return new hots.instances.OptionOrd(a,hots.InstEq.optionEq(a)); | |
} | |
hots.InstOrd.arrayOrd = function(a) { | |
return new hots.instances.ArrayOrd(a,hots.InstEq.arrayEq(a)); | |
} | |
hots.InstOrd.tup2Ord = function(a,b) { | |
return new hots.instances.Tup2Ord(a,b,hots.InstEq.tup2Eq(a,b)); | |
} | |
hots.classes.Show = function() { } | |
hots.classes.Show.__name__ = true; | |
hots.instances.FloatShow = function() { | |
}; | |
hots.instances.FloatShow.__name__ = true; | |
hots.instances.FloatShow.__interfaces__ = [hots.classes.Show]; | |
hots.instances.FloatShow.prototype = { | |
show: function(v) { | |
return Std.string(v); | |
} | |
} | |
hots.instances.IntShow = function() { | |
}; | |
hots.instances.IntShow.__name__ = true; | |
hots.instances.IntShow.__interfaces__ = [hots.classes.Show]; | |
hots.instances.IntShow.prototype = { | |
show: function(v) { | |
return Std.string(v); | |
} | |
} | |
hots.instances.StringShow = function() { | |
}; | |
hots.instances.StringShow.__name__ = true; | |
hots.instances.StringShow.__interfaces__ = [hots.classes.Show]; | |
hots.instances.StringShow.prototype = { | |
show: function(v) { | |
return v; | |
} | |
} | |
hots.InstShow = function() { } | |
hots.InstShow.__name__ = true; | |
hots.InstShow.arrayShow = function(showT) { | |
return new hots.instances.ArrayShow(showT); | |
} | |
hots.InstShow.optionShow = function(showT) { | |
return new hots.instances.OptionShow(showT); | |
} | |
hots.InstShow.tup2Show = function(show1,show2) { | |
return hots.extensions.Shows.create(function(t) { | |
return "(" + show1.show(t._1) + ", " + show2.show(t._2) + ")"; | |
}); | |
} | |
hots.InstShow.validationShow = function(showF,showS) { | |
return hots.extensions.Shows.create(function(v) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 1: | |
var v_eSuccess_0 = $e[2]; | |
$r = "Success(" + showS.show(v_eSuccess_0) + ")"; | |
break; | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
$r = "Failure(" + showF.show(v_eFailure_0) + ")"; | |
break; | |
} | |
return $r; | |
}(this)); | |
}); | |
} | |
hots.classes.Num = function() { } | |
hots.classes.Num.__name__ = true; | |
hots.classes.Num.__interfaces__ = [hots.classes.Show,hots.classes.Eq]; | |
hots.classes.NumAbstract = function(eqT,showT) { | |
this.eqT = eqT; | |
this.showT = showT; | |
}; | |
hots.classes.NumAbstract.__name__ = true; | |
hots.classes.NumAbstract.__interfaces__ = [hots.classes.Num]; | |
hots.classes.NumAbstract.prototype = { | |
notEq: function(a,b) { | |
return this.eqT.notEq(a,b); | |
} | |
,eq: function(a,b) { | |
return this.eqT.eq(a,b); | |
} | |
,show: function(a) { | |
return this.showT.show(a); | |
} | |
,fromInt: function(a) { | |
return scuts.Scuts.abstractMethod(); | |
} | |
,signum: function(a) { | |
return scuts.Scuts.abstractMethod(); | |
} | |
,abs: function(a) { | |
return scuts.Scuts.abstractMethod(); | |
} | |
,negate: function(a) { | |
return scuts.Scuts.abstractMethod(); | |
} | |
,mul: function(a,b) { | |
return scuts.Scuts.abstractMethod(); | |
} | |
,plus: function(a,b) { | |
return scuts.Scuts.abstractMethod(); | |
} | |
,minus: function(a,b) { | |
return this.minus(a,this.negate(b)); | |
} | |
} | |
hots.instances.IntNum = function(eq,show) { | |
hots.classes.NumAbstract.call(this,eq,show); | |
}; | |
hots.instances.IntNum.__name__ = true; | |
hots.instances.IntNum.__super__ = hots.classes.NumAbstract; | |
hots.instances.IntNum.prototype = $extend(hots.classes.NumAbstract.prototype,{ | |
fromInt: function(a) { | |
return a; | |
} | |
,signum: function(a) { | |
return a > 0?1:a < 0?-1:0; | |
} | |
,abs: function(a) { | |
return a > 0?a:-1; | |
} | |
,negate: function(a) { | |
return -a; | |
} | |
,minus: function(a,b) { | |
return a - b; | |
} | |
,mul: function(a,b) { | |
return a * b; | |
} | |
,plus: function(a,b) { | |
return a + b; | |
} | |
}); | |
hots.InstNum = function() { } | |
hots.InstNum.__name__ = true; | |
hots.classes.Functor = function() { } | |
hots.classes.Functor.__name__ = true; | |
hots.instances.ArrayFunctor = function() { | |
}; | |
hots.instances.ArrayFunctor.__name__ = true; | |
hots.instances.ArrayFunctor.__interfaces__ = [hots.classes.Functor]; | |
hots.instances.ArrayFunctor.prototype = { | |
map: function(x,f) { | |
return scuts.core.Arrays.map(x,f); | |
} | |
} | |
hots.instances.OptionFunctor = function() { | |
}; | |
hots.instances.OptionFunctor.__name__ = true; | |
hots.instances.OptionFunctor.__interfaces__ = [hots.classes.Functor]; | |
hots.instances.OptionFunctor.prototype = { | |
map: function(x,f) { | |
return scuts.core.Options.map(x,f); | |
} | |
} | |
hots.instances.PromiseFunctor = function() { | |
}; | |
hots.instances.PromiseFunctor.__name__ = true; | |
hots.instances.PromiseFunctor.__interfaces__ = [hots.classes.Functor]; | |
hots.instances.PromiseFunctor.prototype = { | |
map: function(of,f) { | |
return scuts.core.Promises.map(of,f); | |
} | |
} | |
hots.InstFunctor = function() { } | |
hots.InstFunctor.__name__ = true; | |
hots.InstFunctor.stateFunctor = function() { | |
return new hots.instances.StateFunctor(); | |
} | |
hots.InstFunctor.contFunctor = function() { | |
return new hots.instances.ContFunctor(); | |
} | |
hots.InstFunctor.validationFunctor = function() { | |
return new hots.instances.ValidationFunctor(); | |
} | |
hots.InstFunctor.lazyTFunctor = function(f) { | |
return new hots.instances.LazyTFunctor(f); | |
} | |
hots.InstFunctor.arrayTFunctor = function(base) { | |
return new hots.instances.ArrayTFunctor(base); | |
} | |
hots.InstFunctor.optionTFunctor = function(base) { | |
return new hots.instances.OptionTFunctor(base); | |
} | |
hots.InstFunctor.validationTFunctor = function(base) { | |
return new hots.instances.ValidationTFunctor(base); | |
} | |
hots.classes.Pure = function() { } | |
hots.classes.Pure.__name__ = true; | |
hots.instances.ArrayPure = function() { | |
}; | |
hots.instances.ArrayPure.__name__ = true; | |
hots.instances.ArrayPure.__interfaces__ = [hots.classes.Pure]; | |
hots.instances.ArrayPure.prototype = { | |
pure: function(b) { | |
return [b]; | |
} | |
} | |
hots.instances.OptionPure = function() { | |
}; | |
hots.instances.OptionPure.__name__ = true; | |
hots.instances.OptionPure.__interfaces__ = [hots.classes.Pure]; | |
hots.instances.OptionPure.prototype = { | |
pure: function(b) { | |
return scuts.core.Options.pure(b); | |
} | |
} | |
hots.instances.PromisePure = function() { | |
}; | |
hots.instances.PromisePure.__name__ = true; | |
hots.instances.PromisePure.__interfaces__ = [hots.classes.Pure]; | |
hots.instances.PromisePure.prototype = { | |
pure: function(a) { | |
return scuts.core.Promises.pure(a); | |
} | |
} | |
hots.InstPure = function() { } | |
hots.InstPure.__name__ = true; | |
hots.InstPure.validationPure = function() { | |
return new hots.instances.ValidationPure(); | |
} | |
hots.InstPure.statePure = function() { | |
return new hots.instances.StatePure(); | |
} | |
hots.InstPure.arrayTPure = function(base) { | |
return new hots.instances.ArrayTPure(base); | |
} | |
hots.InstPure.optionTPure = function(base) { | |
return new hots.instances.OptionTPure(base); | |
} | |
hots.InstPure.validationTPure = function(base) { | |
return new hots.instances.ValidationTPure(base); | |
} | |
hots.classes.Empty = function() { } | |
hots.classes.Empty.__name__ = true; | |
hots.instances.ArrayEmpty = function() { | |
}; | |
hots.instances.ArrayEmpty.__name__ = true; | |
hots.instances.ArrayEmpty.__interfaces__ = [hots.classes.Empty]; | |
hots.instances.ArrayEmpty.prototype = { | |
empty: function() { | |
return []; | |
} | |
} | |
hots.instances.OptionEmpty = function() { | |
}; | |
hots.instances.OptionEmpty.__name__ = true; | |
hots.instances.OptionEmpty.__interfaces__ = [hots.classes.Empty]; | |
hots.instances.OptionEmpty.prototype = { | |
empty: function() { | |
return scuts.core.Option.None; | |
} | |
} | |
hots.instances.PromiseEmpty = function() { | |
}; | |
hots.instances.PromiseEmpty.__name__ = true; | |
hots.instances.PromiseEmpty.__interfaces__ = [hots.classes.Empty]; | |
hots.instances.PromiseEmpty.prototype = { | |
empty: function() { | |
return scuts.core.Promises.cancelled(); | |
} | |
} | |
hots.InstEmpty = function() { } | |
hots.InstEmpty.__name__ = true; | |
hots.InstEmpty.validationEmpty = function(failureMonoid) { | |
return new hots.instances.ValidationEmpty(failureMonoid); | |
} | |
hots.InstEmpty.optionTEmpty = function(base) { | |
return new hots.instances.OptionTEmpty(base); | |
} | |
hots.classes.Apply = function() { } | |
hots.classes.Apply.__name__ = true; | |
hots.instances.ArrayApply = function() { | |
}; | |
hots.instances.ArrayApply.__name__ = true; | |
hots.instances.ArrayApply.__interfaces__ = [hots.classes.Apply]; | |
hots.instances.ArrayApply.prototype = { | |
apply: function(f,v) { | |
var res = []; | |
var _g = 0, _g1 = f; | |
while(_g < _g1.length) { | |
var f1 = _g1[_g]; | |
++_g; | |
var _g2 = 0, _g3 = v; | |
while(_g2 < _g3.length) { | |
var v1 = _g3[_g2]; | |
++_g2; | |
res.push(f1(v1)); | |
} | |
} | |
return res; | |
} | |
} | |
hots.instances.OptionApply = function() { | |
}; | |
hots.instances.OptionApply.__name__ = true; | |
hots.instances.OptionApply.__interfaces__ = [hots.classes.Apply]; | |
hots.instances.OptionApply.prototype = { | |
apply1: function(f,x) { | |
return (function($this) { | |
var $r; | |
var $e = (f); | |
switch( $e[1] ) { | |
case 0: | |
var f_eSome_0 = $e[2]; | |
$r = scuts.core.Options.map(x,f_eSome_0); | |
break; | |
case 1: | |
$r = scuts.core.Option.None; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
,apply: function(f,x) { | |
return this.apply1(f,x); | |
} | |
} | |
hots.instances.PromiseApply = function() { | |
}; | |
hots.instances.PromiseApply.__name__ = true; | |
hots.instances.PromiseApply.__interfaces__ = [hots.classes.Apply]; | |
hots.instances.PromiseApply.prototype = { | |
apply: function(f,x) { | |
return scuts.core.Promises.apply(f,x); | |
} | |
} | |
hots.InstApply = function() { } | |
hots.InstApply.__name__ = true; | |
hots.InstApply.contApply = function() { | |
return hots.extensions.Applys.createFromFunctorAndBind(hots.InstFunctor.contFunctor(),hots.InstBind.contBind()); | |
} | |
hots.InstApply.validationApply = function(failureSemi) { | |
return new hots.instances.ValidationApply(failureSemi); | |
} | |
hots.InstApply.stateApply = function() { | |
return new hots.instances.StateApply(); | |
} | |
hots.InstApply.arrayTApply = function(appM,funcM) { | |
return new hots.instances.ArrayTApply(appM,funcM); | |
} | |
hots.InstApply.optionTApply = function(appM,funcM) { | |
return new hots.instances.OptionTApply(appM,funcM); | |
} | |
hots.InstApply.validationTApply = function(funcM,appM) { | |
return new hots.instances.ValidationTApply(funcM,appM); | |
} | |
hots.classes.Bind = function() { } | |
hots.classes.Bind.__name__ = true; | |
hots.instances.ArrayBind = function() { | |
}; | |
hots.instances.ArrayBind.__name__ = true; | |
hots.instances.ArrayBind.__interfaces__ = [hots.classes.Bind]; | |
hots.instances.ArrayBind.prototype = { | |
flatMap: function(x,f) { | |
return scuts.core.Arrays.flatMap(x,f); | |
} | |
} | |
hots.instances.OptionBind = function() { | |
}; | |
hots.instances.OptionBind.__name__ = true; | |
hots.instances.OptionBind.__interfaces__ = [hots.classes.Bind]; | |
hots.instances.OptionBind.prototype = { | |
flatMap: function(x,f) { | |
return scuts.core.Options.flatMap(x,f); | |
} | |
} | |
hots.instances.PromiseBind = function() { | |
}; | |
hots.instances.PromiseBind.__name__ = true; | |
hots.instances.PromiseBind.__interfaces__ = [hots.classes.Bind]; | |
hots.instances.PromiseBind.prototype = { | |
flatMap: function(val,f) { | |
return scuts.core.Promises.flatMap(val,f); | |
} | |
} | |
hots.InstBind = function() { } | |
hots.InstBind.__name__ = true; | |
hots.InstBind.contBind = function() { | |
return new hots.instances.ContBind(); | |
} | |
hots.InstBind.validationBind = function() { | |
return new hots.instances.ValidationBind(); | |
} | |
hots.InstBind.stateBind = function() { | |
return new hots.instances.StateBind(); | |
} | |
hots.InstBind.arrayTBind = function(base) { | |
return new hots.instances.ArrayTBind(base); | |
} | |
hots.InstBind.optionTBind = function(base) { | |
return new hots.instances.OptionTBind(base); | |
} | |
hots.InstBind.validationTBind = function(base) { | |
return new hots.instances.ValidationTBind(base); | |
} | |
hots.extensions = {} | |
hots.extensions.Applicatives = function() { } | |
hots.extensions.Applicatives.__name__ = true; | |
hots.extensions.Applicatives.apply = function(f,val,a) { | |
return a.apply(f,val); | |
} | |
hots.extensions.Applicatives.thenRight = function(val1,val2,a) { | |
return a.thenRight(val1,val2); | |
} | |
hots.extensions.Applicatives.thenLeft = function(val1,val2,a) { | |
return a.thenLeft(val1,val2); | |
} | |
hots.extensions.Applicatives.ap = function(f,m) { | |
return function(a) { | |
return m.apply(f,a); | |
}; | |
} | |
hots.extensions.Applicatives.create = function(pure,apply,functor) { | |
return new hots.extensions.ApplicativeDefault(pure,apply,functor); | |
} | |
hots.classes.Pointed = function() { } | |
hots.classes.Pointed.__name__ = true; | |
hots.classes.Pointed.__interfaces__ = [hots.classes.Pure,hots.classes.Functor]; | |
hots.classes.Applicative = function() { } | |
hots.classes.Applicative.__name__ = true; | |
hots.classes.Applicative.__interfaces__ = [hots.classes.Apply,hots.classes.Pointed]; | |
hots.extensions.ApplicativeDefault = function(pure,apply,functor) { | |
this._pure = pure; | |
this._functor = functor; | |
this._apply = apply; | |
}; | |
hots.extensions.ApplicativeDefault.__name__ = true; | |
hots.extensions.ApplicativeDefault.__interfaces__ = [hots.classes.Applicative]; | |
hots.extensions.ApplicativeDefault.prototype = { | |
pure: function(x) { | |
return this._pure.pure(x); | |
} | |
,map: function(of,f) { | |
return this._functor.map(of,f); | |
} | |
,thenLeft: function(of1,of2) { | |
return of1; | |
} | |
,thenRight: function(of1,of2) { | |
return of2; | |
} | |
,apply: function(f,of) { | |
return this._apply.apply(f,of); | |
} | |
} | |
hots.InstApplicative = function() { } | |
hots.InstApplicative.__name__ = true; | |
hots.InstApplicative.stateApplicative = function() { | |
return hots.extensions.Applicatives.create(hots.InstPure.statePure(),hots.InstApply.stateApply(),hots.InstFunctor.stateFunctor()); | |
} | |
hots.InstApplicative.validationApplicative = function(semiFailure) { | |
return hots.extensions.Applicatives.create(hots.InstPure.validationPure(),hots.InstApply.validationApply(semiFailure),hots.InstFunctor.validationFunctor()); | |
} | |
hots.InstApplicative.arrayTApplicative = function(base) { | |
return hots.extensions.Applicatives.create(hots.InstPure.arrayTPure(base),hots.InstApply.arrayTApply(base,base),hots.InstFunctor.arrayTFunctor(base)); | |
} | |
hots.InstApplicative.optionTApplicative = function(base) { | |
return hots.extensions.Applicatives.create(hots.InstPure.optionTPure(base),hots.InstApply.optionTApply(base,base),hots.InstFunctor.optionTFunctor(base)); | |
} | |
hots.InstApplicative.validationTApplicative = function(base) { | |
return hots.extensions.Applicatives.create(hots.InstPure.validationTPure(base),hots.InstApply.validationTApply(base,base),hots.InstFunctor.validationTFunctor(base)); | |
} | |
hots.extensions.Monads = function() { } | |
hots.extensions.Monads.__name__ = true; | |
hots.extensions.Monads.flatMap = function(x,f,m) { | |
return m.flatMap(x,f); | |
} | |
hots.extensions.Monads.flatten = function(x,m) { | |
return m.flatten(x); | |
} | |
hots.extensions.Monads.lift2 = function(f,m) { | |
return function(v1,v2) { | |
return m.flatMap(v1,function(x1) { | |
return m.flatMap(v2,function(x2) { | |
return m.pure(f(x1,x2)); | |
}); | |
}); | |
}; | |
} | |
hots.extensions.Monads.ap = function(f,m) { | |
return function(v) { | |
return m.flatMap(f,function(f1) { | |
return m.map(v,function(a2) { | |
return f1(a2); | |
}); | |
}); | |
}; | |
} | |
hots.extensions.Monads.sequence = function(arr,m) { | |
var k = function(m1,m2) { | |
return m.flatMap(m1,function(x) { | |
return m.flatMap(m2,function(xs) { | |
return m.pure([x].concat(xs)); | |
}); | |
}); | |
}; | |
return scuts.core.Arrays.foldRight(arr,m.pure([]),k); | |
} | |
hots.extensions.Monads.mapM = function(a,f,m) { | |
return hots.extensions.Monads.sequence(scuts.core.Arrays.map(a,f),m); | |
} | |
hots.extensions.Monads.createFromApplicativeAndBind = function(app,bind) { | |
return new hots.extensions.MonadFromApplicativeAndBind(app,bind); | |
} | |
hots.classes.Monad = function() { } | |
hots.classes.Monad.__name__ = true; | |
hots.classes.Monad.__interfaces__ = [hots.classes.Bind,hots.classes.Applicative]; | |
hots.extensions.MonadFromApplicativeAndBind = function(applicative,bind) { | |
this.bind = bind; | |
this.applicative = applicative; | |
}; | |
hots.extensions.MonadFromApplicativeAndBind.__name__ = true; | |
hots.extensions.MonadFromApplicativeAndBind.__interfaces__ = [hots.classes.Monad]; | |
hots.extensions.MonadFromApplicativeAndBind.prototype = { | |
thenLeft: function(val1,val2) { | |
return this.applicative.thenLeft(val1,val2); | |
} | |
,thenRight: function(val1,val2) { | |
return this.applicative.thenRight(val1,val2); | |
} | |
,apply: function(f,val) { | |
return this.applicative.apply(f,val); | |
} | |
,pure: function(x) { | |
return this.applicative.pure(x); | |
} | |
,map: function(val,f) { | |
return this.applicative.map(val,f); | |
} | |
,flatten: function(val) { | |
return this.flatMap(val,scuts.Scuts.id); | |
} | |
,flatMap: function(val,f) { | |
return this.bind.flatMap(val,f); | |
} | |
} | |
hots.InstMonad = function() { } | |
hots.InstMonad.__name__ = true; | |
hots.InstMonad.stateMonad = function() { | |
return hots.extensions.Monads.createFromApplicativeAndBind(hots.InstApplicative.stateApplicative(),hots.InstBind.stateBind()); | |
} | |
hots.InstMonad.validationMonad = function(semiFailure) { | |
return hots.extensions.Monads.createFromApplicativeAndBind(hots.InstApplicative.validationApplicative(semiFailure),hots.InstBind.validationBind()); | |
} | |
hots.InstMonad.arrayTMonad = function(base) { | |
return hots.extensions.Monads.createFromApplicativeAndBind(hots.InstApplicative.arrayTApplicative(base),hots.InstBind.arrayTBind(base)); | |
} | |
hots.InstMonad.optionTMonad = function(base) { | |
return hots.extensions.Monads.createFromApplicativeAndBind(hots.InstApplicative.optionTApplicative(base),hots.InstBind.optionTBind(base)); | |
} | |
hots.InstMonad.validationTMonad = function(base) { | |
return hots.extensions.Monads.createFromApplicativeAndBind(hots.InstApplicative.validationTApplicative(base),hots.InstBind.validationTBind(base)); | |
} | |
hots.extensions.MonadEmptys = function() { } | |
hots.extensions.MonadEmptys.__name__ = true; | |
hots.extensions.MonadEmptys.empty = function(m) { | |
return m.empty(); | |
} | |
hots.extensions.MonadEmptys.filter = function(o,f,m) { | |
return m.flatMap(o,function(x) { | |
return f(x)?m.pure(x):m.empty(); | |
}); | |
} | |
hots.extensions.MonadEmptys.createFromMonadAndEmpty = function(m,e) { | |
return new hots.extensions.MonadEmptyDefault(m,e); | |
} | |
hots.classes.MonadEmpty = function() { } | |
hots.classes.MonadEmpty.__name__ = true; | |
hots.classes.MonadEmpty.__interfaces__ = [hots.classes.Empty,hots.classes.Monad]; | |
hots.extensions.MonadEmptyDefault = function(monad,empty) { | |
this.monad = monad; | |
this._empty = empty; | |
}; | |
hots.extensions.MonadEmptyDefault.__name__ = true; | |
hots.extensions.MonadEmptyDefault.__interfaces__ = [hots.classes.MonadEmpty]; | |
hots.extensions.MonadEmptyDefault.prototype = { | |
flatten: function(val) { | |
return this.monad.flatten(val); | |
} | |
,flatMap: function(val,f) { | |
return this.monad.flatMap(val,f); | |
} | |
,thenLeft: function(val1,val2) { | |
return this.monad.thenLeft(val1,val2); | |
} | |
,thenRight: function(val1,val2) { | |
return this.monad.thenRight(val1,val2); | |
} | |
,apply: function(f,val) { | |
return this.monad.apply(f,val); | |
} | |
,pure: function(x) { | |
return this.monad.pure(x); | |
} | |
,map: function(val,f) { | |
return this.monad.map(val,f); | |
} | |
,empty: function() { | |
return this._empty.empty(); | |
} | |
} | |
hots.InstMonadEmpty = function() { } | |
hots.InstMonadEmpty.__name__ = true; | |
hots.classes.Category = function() { } | |
hots.classes.Category.__name__ = true; | |
hots.classes.CategoryAbstract = function() { } | |
hots.classes.CategoryAbstract.__name__ = true; | |
hots.classes.CategoryAbstract.__interfaces__ = [hots.classes.Category]; | |
hots.classes.CategoryAbstract.prototype = { | |
back: function(g,f) { | |
return this.dot(g,f); | |
} | |
,next: function(f,g) { | |
return this.dot(g,f); | |
} | |
,dot: function(g,f) { | |
return scuts.Scuts.abstractMethod(); | |
} | |
,id: function(a) { | |
return scuts.Scuts.abstractMethod(); | |
} | |
} | |
hots.instances.FunctionCategory = function() { | |
}; | |
hots.instances.FunctionCategory.__name__ = true; | |
hots.instances.FunctionCategory.__super__ = hots.classes.CategoryAbstract; | |
hots.instances.FunctionCategory.prototype = $extend(hots.classes.CategoryAbstract.prototype,{ | |
dot: function(f,g) { | |
return scuts.core.Function1s.compose(f,g); | |
} | |
,id: function(a) { | |
return function(a1) { | |
return a1; | |
}; | |
} | |
}); | |
hots.InstCategory = function() { } | |
hots.InstCategory.__name__ = true; | |
hots.InstCategory.kleisliCategory = function(m) { | |
return new hots.instances.KleisliCategory(m); | |
} | |
hots.classes.Arrow = function() { } | |
hots.classes.Arrow.__name__ = true; | |
hots.classes.Arrow.__interfaces__ = [hots.classes.Category]; | |
hots.classes.ArrowAbstract = function(category) { | |
this.c = category; | |
}; | |
hots.classes.ArrowAbstract.__name__ = true; | |
hots.classes.ArrowAbstract.__interfaces__ = [hots.classes.Arrow]; | |
hots.classes.ArrowAbstract.prototype = { | |
back: function(g,f) { | |
return this.c.back(g,f); | |
} | |
,next: function(f,g) { | |
return this.c.next(f,g); | |
} | |
,dot: function(g,f) { | |
return this.c.dot(g,f); | |
} | |
,id: function(a) { | |
return this.c.id(a); | |
} | |
,fanout: function(f,g) { | |
return hots.extensions.Categories.next(this.arr(function(x) { | |
return scuts.core.Tup2.create(x,x); | |
}),this.split(f,g),this.c); | |
} | |
,split: function(f,g) { | |
return hots.extensions.Categories.next(this.first(f),this.second(g),this.c); | |
} | |
,second: function(f) { | |
return hots.extensions.Categories.next(hots.extensions.Categories.next(this.arr(scuts.core.Tup2s.swap),this.first(f),this.c),this.arr(scuts.core.Tup2s.swap),this.c); | |
} | |
,first: function(f) { | |
return scuts.Scuts.abstractMethod(); | |
} | |
,arr: function(f) { | |
return scuts.Scuts.abstractMethod(); | |
} | |
} | |
hots.instances.FunctionArrow = function(cat) { | |
hots.classes.ArrowAbstract.call(this,cat); | |
}; | |
hots.instances.FunctionArrow.__name__ = true; | |
hots.instances.FunctionArrow.__super__ = hots.classes.ArrowAbstract; | |
hots.instances.FunctionArrow.prototype = $extend(hots.classes.ArrowAbstract.prototype,{ | |
first: function(f) { | |
return hots.box.FunctionBox.asArrow(function(t) { | |
return scuts.core.Tup2.create((hots.box.FunctionBox.runArrow(f))(t._1),t._2); | |
}); | |
} | |
,arr: function(f) { | |
return hots.box.FunctionBox.asArrow(f); | |
} | |
}); | |
hots.InstArrow = function() { } | |
hots.InstArrow.__name__ = true; | |
hots.InstArrow.kleisliArrow = function(m) { | |
return new hots.instances.KleisliArrow(m,hots.InstCategory.kleisliCategory(m)); | |
} | |
hots.classes.Semigroup = function() { } | |
hots.classes.Semigroup.__name__ = true; | |
hots.instances.IntProductSemigroup = function() { | |
}; | |
hots.instances.IntProductSemigroup.__name__ = true; | |
hots.instances.IntProductSemigroup.__interfaces__ = [hots.classes.Semigroup]; | |
hots.instances.IntProductSemigroup.prototype = { | |
append: function(a,b) { | |
return a * b; | |
} | |
} | |
hots.instances.IntSumSemigroup = function() { | |
}; | |
hots.instances.IntSumSemigroup.__name__ = true; | |
hots.instances.IntSumSemigroup.__interfaces__ = [hots.classes.Semigroup]; | |
hots.instances.IntSumSemigroup.prototype = { | |
append: function(a,b) { | |
return a + b; | |
} | |
} | |
hots.instances.StringSemigroup = function() { | |
}; | |
hots.instances.StringSemigroup.__name__ = true; | |
hots.instances.StringSemigroup.__interfaces__ = [hots.classes.Semigroup]; | |
hots.instances.StringSemigroup.prototype = { | |
append: function(a,b) { | |
return a + b; | |
} | |
} | |
hots.InstSemigroup = function() { } | |
hots.InstSemigroup.__name__ = true; | |
hots.InstSemigroup.arraySemigroup = function() { | |
return new hots.instances.ArraySemigroup(); | |
} | |
hots.InstSemigroup.endoSemigroup = function() { | |
return new hots.instances.EndoSemigroup(); | |
} | |
hots.InstSemigroup.dualSemigroup = function(semiT) { | |
return new hots.instances.DualSemigroup(semiT); | |
} | |
hots.InstSemigroup.eitherSemigroup = function(semiL,semiR) { | |
return new hots.instances.EitherSemigroup(semiL,semiR); | |
} | |
hots.InstSemigroup.tup2Semigroup = function(semi1,semi2) { | |
return new hots.instances.Tup2Semigroup(semi1,semi2); | |
} | |
hots.InstSemigroup.tup3Semigroup = function(semi1,semi2,semi3) { | |
return new hots.instances.Tup3Semigroup(semi1,semi2,semi3); | |
} | |
hots.InstSemigroup.validationSemigroup = function(semiF,semiS) { | |
return new hots.instances.ValidationSemigroup(semiF,semiS); | |
} | |
hots.InstSemigroup.optionSemigroup = function(semiT) { | |
return new hots.instances.OptionSemigroup(semiT); | |
} | |
hots.classes.Zero = function() { } | |
hots.classes.Zero.__name__ = true; | |
hots.instances.EndoZero = function() { | |
}; | |
hots.instances.EndoZero.__name__ = true; | |
hots.instances.EndoZero.__interfaces__ = [hots.classes.Zero]; | |
hots.instances.EndoZero.prototype = { | |
zero: function() { | |
return scuts.Scuts.id; | |
} | |
} | |
hots.instances.IntProductZero = function() { | |
}; | |
hots.instances.IntProductZero.__name__ = true; | |
hots.instances.IntProductZero.__interfaces__ = [hots.classes.Zero]; | |
hots.instances.IntProductZero.prototype = { | |
zero: function() { | |
return 1; | |
} | |
} | |
hots.instances.IntSumZero = function() { | |
}; | |
hots.instances.IntSumZero.__name__ = true; | |
hots.instances.IntSumZero.__interfaces__ = [hots.classes.Zero]; | |
hots.instances.IntSumZero.prototype = { | |
zero: function() { | |
return 0; | |
} | |
} | |
hots.instances.StringZero = function() { | |
}; | |
hots.instances.StringZero.__name__ = true; | |
hots.instances.StringZero.__interfaces__ = [hots.classes.Zero]; | |
hots.instances.StringZero.prototype = { | |
zero: function() { | |
return ""; | |
} | |
} | |
hots.InstZero = function() { } | |
hots.InstZero.__name__ = true; | |
hots.InstZero.arrayZero = function() { | |
return new hots.instances.ArrayZero(); | |
} | |
hots.InstZero.optionZero = function() { | |
return new hots.instances.OptionZero(); | |
} | |
hots.classes.Monoid = function() { } | |
hots.classes.Monoid.__name__ = true; | |
hots.classes.Monoid.__interfaces__ = [hots.classes.Zero,hots.classes.Semigroup]; | |
hots.extensions.MonoidDefault = function(semi,zero) { | |
this.semi = semi; | |
this._zero = zero; | |
}; | |
hots.extensions.MonoidDefault.__name__ = true; | |
hots.extensions.MonoidDefault.__interfaces__ = [hots.classes.Monoid]; | |
hots.extensions.MonoidDefault.prototype = { | |
append: function(a1,a2) { | |
return this.semi.append(a1,a2); | |
} | |
,zero: function() { | |
return this._zero.zero(); | |
} | |
} | |
hots.InstMonoid = function() { } | |
hots.InstMonoid.__name__ = true; | |
hots.InstMonoid.arrayMonoid = function() { | |
return new hots.extensions.MonoidDefault(hots.InstSemigroup.arraySemigroup(),hots.InstZero.arrayZero()); | |
} | |
hots.InstMonoid.endoMonoid = function() { | |
return new hots.extensions.MonoidDefault(hots.InstSemigroup.endoSemigroup(),hots.InstZero.endoZero); | |
} | |
hots.InstMonoid.optionMonoid = function(semiT) { | |
return new hots.extensions.MonoidDefault(hots.InstSemigroup.optionSemigroup(semiT),hots.InstZero.optionZero()); | |
} | |
hots.InstMonoid.dualMonoid = function(monoidT) { | |
return new hots.extensions.MonoidDefault(hots.InstSemigroup.dualSemigroup(monoidT),monoidT); | |
} | |
hots.classes.Foldable = function() { } | |
hots.classes.Foldable.__name__ = true; | |
hots.classes.FoldableAbstract = function() { } | |
hots.classes.FoldableAbstract.__name__ = true; | |
hots.classes.FoldableAbstract.__interfaces__ = [hots.classes.Foldable]; | |
hots.classes.FoldableAbstract.prototype = { | |
foldRight1: function(x,f) { | |
var mf = function(x1,o) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 1: | |
$r = scuts.core.Option.Some(x1); | |
break; | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = scuts.core.Option.Some(f(x1,o_eSome_0)); | |
break; | |
} | |
return $r; | |
}(this)); | |
}; | |
var foldRes = this.foldRight(x,scuts.core.Option.None,mf); | |
return (function($this) { | |
var $r; | |
var $e = (foldRes); | |
switch( $e[1] ) { | |
case 1: | |
$r = scuts.Scuts.error("foldRight1: Cannot fold over an empty Foldable Value",{ fileName : "FoldableAbstract.hx", lineNumber : 88, className : "hots.classes.FoldableAbstract", methodName : "foldRight1"}); | |
break; | |
case 0: | |
var foldRes_eSome_0 = $e[2]; | |
$r = foldRes_eSome_0; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
,foldLeft1: function(x,f) { | |
var mf = function(o,y) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 1: | |
$r = scuts.core.Option.Some(y); | |
break; | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = scuts.core.Option.Some(f(o_eSome_0,y)); | |
break; | |
} | |
return $r; | |
}(this)); | |
}; | |
var foldRes = this.foldLeft(x,scuts.core.Option.None,mf); | |
return (function($this) { | |
var $r; | |
var $e = (foldRes); | |
switch( $e[1] ) { | |
case 1: | |
$r = scuts.Scuts.error("foldLeft1: Cannot fold over an empty Foldable Value",{ fileName : "FoldableAbstract.hx", lineNumber : 71, className : "hots.classes.FoldableAbstract", methodName : "foldLeft1"}); | |
break; | |
case 0: | |
var foldRes_eSome_0 = $e[2]; | |
$r = foldRes_eSome_0; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
,foldRight: function(x,b,f) { | |
var x1 = this.foldMap(x,scuts.core.Function2s.curry(f),hots.InstMonoid.endoMonoid()); | |
return x1(b); | |
} | |
,foldLeft: function(of,b,f) { | |
var f1 = scuts.core.Function2s.curry(scuts.core.Function2s.flip(f)); | |
var mon = hots.InstMonoid.dualMonoid(hots.InstMonoid.endoMonoid()); | |
return (this.foldMap(of,f1,mon))(b); | |
} | |
,foldMap: function(x,f,mon) { | |
var newF = scuts.core.Function2s.uncurry(scuts.core.Function1s.compose(scuts.core.Function2s.curry($bind(mon,mon.append)),f)); | |
return this.foldRight(x,mon.zero(),newF); | |
} | |
,fold: function(x,mon) { | |
return this.foldMap(x,scuts.Scuts.id,mon); | |
} | |
} | |
hots.instances.ArrayFoldable = function() { | |
}; | |
hots.instances.ArrayFoldable.__name__ = true; | |
hots.instances.ArrayFoldable.__super__ = hots.classes.FoldableAbstract; | |
hots.instances.ArrayFoldable.prototype = $extend(hots.classes.FoldableAbstract.prototype,{ | |
foldLeft: function(of,b,f) { | |
return scuts.core.Arrays.foldLeft(of,b,f); | |
} | |
,foldRight: function(of,b,f) { | |
return scuts.core.Arrays.foldRight(of,b,f); | |
} | |
}); | |
hots.InstFoldable = function() { } | |
hots.InstFoldable.__name__ = true; | |
hots.ImplicitObject = function() { } | |
hots.ImplicitObject.__name__ = true; | |
hots.box = {} | |
hots.box.ArrayBox = function() { } | |
hots.box.ArrayBox.__name__ = true; | |
hots.box.ArrayBox.box = function(a) { | |
return a; | |
} | |
hots.box.ArrayBox.unbox = function(a) { | |
return a; | |
} | |
hots.box.ArrayBox.box0 = function(a) { | |
return a; | |
} | |
hots.box.ArrayBox.unbox0 = function(a) { | |
return a; | |
} | |
hots.box.ArrayBox.boxF = function(a) { | |
return a; | |
} | |
hots.box.ArrayBox.unboxF = function(e) { | |
return e; | |
} | |
hots.box.ArrayBox.boxT = function(a) { | |
return a; | |
} | |
hots.box.ArrayBox.unboxT = function(a) { | |
return a; | |
} | |
hots.box.ArrayBox.boxFT = function(a) { | |
return a; | |
} | |
hots.box.ArrayBox.unboxFT = function(a) { | |
return a; | |
} | |
hots.box.FunctionBox = function() { } | |
hots.box.FunctionBox.__name__ = true; | |
hots.box.FunctionBox.asArrow = function(f) { | |
return f; | |
} | |
hots.box.FunctionBox.runArrow = function(f) { | |
return f; | |
} | |
hots.box.Function0Box = function() { } | |
hots.box.Function0Box.__name__ = true; | |
hots.box.Function0Box.box = function(f) { | |
return f; | |
} | |
hots.box.Function0Box.unbox = function(f) { | |
return f; | |
} | |
hots.box.Function1Box = function() { } | |
hots.box.Function1Box.__name__ = true; | |
hots.box.Function1Box.box = function(f) { | |
return f; | |
} | |
hots.box.Function1Box.unbox = function(f) { | |
return f; | |
} | |
hots.box.KleisliBox = function() { } | |
hots.box.KleisliBox.__name__ = true; | |
hots.box.KleisliBox.asKleisli = function(m) { | |
return m; | |
} | |
hots.box.KleisliBox.box = function(m) { | |
return m; | |
} | |
hots.box.KleisliBox.unbox = function(m) { | |
return m; | |
} | |
hots.box.LazyBox = function() { } | |
hots.box.LazyBox.__name__ = true; | |
hots.box.LazyBox.boxT = function(a) { | |
return a; | |
} | |
hots.box.LazyBox.unboxT = function(a) { | |
return a; | |
} | |
hots.box.LazyBox.boxFT = function(a) { | |
return a; | |
} | |
hots.box.LazyBox.unboxFT = function(a) { | |
return a; | |
} | |
hots.box.OptionBox = function() { } | |
hots.box.OptionBox.__name__ = true; | |
hots.box.OptionBox.box = function(x) { | |
return x; | |
} | |
hots.box.OptionBox.unbox = function(x) { | |
return x; | |
} | |
hots.box.OptionBox.box0 = function(x) { | |
return x; | |
} | |
hots.box.OptionBox.unbox0 = function(x) { | |
return x; | |
} | |
hots.box.OptionBox.boxF = function(x) { | |
return x; | |
} | |
hots.box.OptionBox.unboxF = function(x) { | |
return x; | |
} | |
hots.box.OptionBox.boxT = function(x) { | |
return x; | |
} | |
hots.box.OptionBox.unboxT = function(x) { | |
return x; | |
} | |
hots.box.OptionBox.boxFT = function(f) { | |
return f; | |
} | |
hots.box.OptionBox.unboxFT = function(f) { | |
return f; | |
} | |
hots.box.PromiseBox = function() { } | |
hots.box.PromiseBox.__name__ = true; | |
hots.box.PromiseBox.box = function(o) { | |
return o; | |
} | |
hots.box.PromiseBox.unbox = function(o) { | |
return o; | |
} | |
hots.box.PromiseBox.box0 = function(o) { | |
return o; | |
} | |
hots.box.PromiseBox.unbox0 = function(o) { | |
return o; | |
} | |
hots.box.PromiseBox.boxF = function(o) { | |
return o; | |
} | |
hots.box.PromiseBox.unboxF = function(o) { | |
return o; | |
} | |
hots.box.PromiseBox.boxT = function(o) { | |
return o; | |
} | |
hots.box.PromiseBox.unboxT = function(o) { | |
return o; | |
} | |
hots.box.PromiseBox.boxFT = function(o) { | |
return o; | |
} | |
hots.box.PromiseBox.unboxFT = function(o) { | |
return o; | |
} | |
hots.box.StateBox = function() { } | |
hots.box.StateBox.__name__ = true; | |
hots.box.StateBox.box = function(a) { | |
return a; | |
} | |
hots.box.StateBox.unbox = function(a) { | |
return a; | |
} | |
hots.box.StateBox.box0 = function(a) { | |
return a; | |
} | |
hots.box.StateBox.unbox0 = function(a) { | |
return a; | |
} | |
hots.box.StateBox.boxF = function(a) { | |
return a; | |
} | |
hots.box.StateBox.unboxF = function(e) { | |
return e; | |
} | |
hots.box.StateBox.boxT = function(a) { | |
return a; | |
} | |
hots.box.StateBox.unboxT = function(a) { | |
return a; | |
} | |
hots.box.ValidationBox = function() { } | |
hots.box.ValidationBox.__name__ = true; | |
hots.box.ValidationBox.boxT = function(a) { | |
return a; | |
} | |
hots.box.ValidationBox.unboxT = function(a) { | |
return a; | |
} | |
hots.box.ValidationBox.box = function(a) { | |
return a; | |
} | |
hots.box.ValidationBox.unbox = function(a) { | |
return a; | |
} | |
hots.box.ValidationBox.box0 = function(a) { | |
return a; | |
} | |
hots.box.ValidationBox.unbox0 = function(a) { | |
return a; | |
} | |
hots.box.ValidationBox.boxF = function(a) { | |
return a; | |
} | |
hots.box.ValidationBox.unboxF = function(a) { | |
return a; | |
} | |
hots.box.ValidationBox.boxFT = function(f) { | |
return f; | |
} | |
hots.box.ValidationBox.unboxFT = function(f) { | |
return f; | |
} | |
hots.box.ValidationBox.validationT = function(o) { | |
return o; | |
} | |
hots.box.ValidationBox.runT = function(o) { | |
return o; | |
} | |
hots.extensions.Applys = function() { } | |
hots.extensions.Applys.__name__ = true; | |
hots.extensions.Applys.createFromFunctorAndBind = function(f,b) { | |
return new hots.extensions.FunctorBindApply(f,b); | |
} | |
hots.extensions.FunctorBindApply = function(t,b) { | |
this.t = t; | |
this.b = b; | |
}; | |
hots.extensions.FunctorBindApply.__name__ = true; | |
hots.extensions.FunctorBindApply.__interfaces__ = [hots.classes.Apply]; | |
hots.extensions.FunctorBindApply.prototype = { | |
apply: function(f,a) { | |
var _g = this; | |
var z = function(g) { | |
return _g.t.map(a,function(x) { | |
return g(x); | |
}); | |
}; | |
return this.b.flatMap(f,z); | |
} | |
} | |
hots.extensions.Arrows = function() { } | |
hots.extensions.Arrows.__name__ = true; | |
hots.extensions.Arrows.arr = function(f,arr) { | |
return arr.arr(f); | |
} | |
hots.extensions.Arrows.split = function(f,g,arr) { | |
return arr.split(f,g); | |
} | |
hots.extensions.Arrows.first = function(f,arr) { | |
return arr.first(f); | |
} | |
hots.extensions.Arrows.second = function(f,arr) { | |
return arr.second(f); | |
} | |
hots.extensions.Arrows.fanout = function(f,g,arr) { | |
return arr.fanout(f,g); | |
} | |
hots.extensions.Categories = function() { } | |
hots.extensions.Categories.__name__ = true; | |
hots.extensions.Categories.id = function(a,cat) { | |
return cat.id(a); | |
} | |
hots.extensions.Categories.next = function(f,g,cat) { | |
return cat.next(f,g); | |
} | |
hots.extensions.Categories.dot = function(g,f,cat) { | |
return cat.dot(g,f); | |
} | |
hots.extensions.Categories.back = function(g,f,cat) { | |
return cat.back(g,f); | |
} | |
hots.extensions.Eqs = function() { } | |
hots.extensions.Eqs.__name__ = true; | |
hots.extensions.Eqs.create = function(f) { | |
return new hots.extensions.EqByFun(f); | |
} | |
hots.extensions.Eqs.eq = function(v1,v2,eq) { | |
return eq.eq(v1,v2); | |
} | |
hots.extensions.Eqs.notEq = function(v1,v2,eq) { | |
return eq.notEq(v1,v2); | |
} | |
hots.extensions.EqByFun = function(f) { | |
this.f = f; | |
}; | |
hots.extensions.EqByFun.__name__ = true; | |
hots.extensions.EqByFun.__super__ = hots.classes.EqAbstract; | |
hots.extensions.EqByFun.prototype = $extend(hots.classes.EqAbstract.prototype,{ | |
eq: function(a,b) { | |
return this.f(a,b); | |
} | |
}); | |
hots.extensions.Monoids = function() { } | |
hots.extensions.Monoids.__name__ = true; | |
hots.extensions.Monoids.append = function(v1,v2,m) { | |
return m.append(v1,v2); | |
} | |
hots.extensions.Monoids.create = function(append,zero) { | |
return new hots.extensions.MonoidByFun(append,zero); | |
} | |
hots.extensions.Monoids.createFromSemiAndZero = function(semi,zero) { | |
return new hots.extensions.MonoidDefault(semi,zero); | |
} | |
hots.extensions.SemigroupByFun = function(append) { | |
this._append = append; | |
}; | |
hots.extensions.SemigroupByFun.__name__ = true; | |
hots.extensions.SemigroupByFun.__interfaces__ = [hots.classes.Semigroup]; | |
hots.extensions.SemigroupByFun.prototype = { | |
append: function(a,b) { | |
return this._append(a,b); | |
} | |
} | |
hots.extensions.MonoidByFun = function(append,zero) { | |
hots.extensions.SemigroupByFun.call(this,append); | |
this._zero = zero; | |
}; | |
hots.extensions.MonoidByFun.__name__ = true; | |
hots.extensions.MonoidByFun.__interfaces__ = [hots.classes.Monoid]; | |
hots.extensions.MonoidByFun.__super__ = hots.extensions.SemigroupByFun; | |
hots.extensions.MonoidByFun.prototype = $extend(hots.extensions.SemigroupByFun.prototype,{ | |
zero: function() { | |
return this._zero(); | |
} | |
}); | |
hots.extensions.Semigroups = function() { } | |
hots.extensions.Semigroups.__name__ = true; | |
hots.extensions.Semigroups.append = function(v1,v2,m) { | |
return m.append(v1,v2); | |
} | |
hots.extensions.Semigroups.create = function(append) { | |
return new hots.extensions.SemigroupByFun(append); | |
} | |
hots.extensions.Shows = function() { } | |
hots.extensions.Shows.__name__ = true; | |
hots.extensions.Shows.show = function(v1,s) { | |
return s.show(v1); | |
} | |
hots.extensions.Shows.create = function(f) { | |
return new hots.extensions._Shows.ShowByFun(f); | |
} | |
hots.extensions._Shows = {} | |
hots.extensions._Shows.ShowByFun = function(f) { | |
this.f = f; | |
}; | |
hots.extensions._Shows.ShowByFun.__name__ = true; | |
hots.extensions._Shows.ShowByFun.__interfaces__ = [hots.classes.Show]; | |
hots.extensions._Shows.ShowByFun.prototype = { | |
show: function(s) { | |
return this.f(s); | |
} | |
} | |
hots.instances.ArrayEq = function(eqT) { | |
this.eqT = eqT; | |
}; | |
hots.instances.ArrayEq.__name__ = true; | |
hots.instances.ArrayEq.__super__ = hots.classes.EqAbstract; | |
hots.instances.ArrayEq.prototype = $extend(hots.classes.EqAbstract.prototype,{ | |
eq: function(a,b) { | |
return scuts.core.Arrays.eq(a,b,($_=this.eqT,$bind($_,$_.eq))); | |
} | |
}); | |
hots.instances.ArrayOrd = function(ordT,eq) { | |
hots.classes.OrdAbstract.call(this,eq); | |
this.ordT = ordT; | |
}; | |
hots.instances.ArrayOrd.__name__ = true; | |
hots.instances.ArrayOrd.__super__ = hots.classes.OrdAbstract; | |
hots.instances.ArrayOrd.prototype = $extend(hots.classes.OrdAbstract.prototype,{ | |
compare: function(a,b) { | |
var smaller = a.length < b.length?a:b; | |
var _g1 = 0, _g = smaller.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
var e1 = a[i]; | |
var e2 = b[i]; | |
var r = this.ordT.compare(e1,e2); | |
if(r != scuts.core.Ordering.EQ) return r; | |
} | |
var diff = a.length - b.length; | |
return diff < 0?scuts.core.Ordering.LT:diff > 0?scuts.core.Ordering.GT:scuts.core.Ordering.EQ; | |
} | |
}); | |
hots.instances.ArraySemigroup = function() { | |
}; | |
hots.instances.ArraySemigroup.__name__ = true; | |
hots.instances.ArraySemigroup.__interfaces__ = [hots.classes.Semigroup]; | |
hots.instances.ArraySemigroup.prototype = { | |
append: function(a1,a2) { | |
return a1.concat(a2); | |
} | |
} | |
hots.instances.ArrayShow = function(showT) { | |
this.showT = showT; | |
}; | |
hots.instances.ArrayShow.__name__ = true; | |
hots.instances.ArrayShow.__interfaces__ = [hots.classes.Show]; | |
hots.instances.ArrayShow.prototype = { | |
show: function(v) { | |
var _g = this; | |
return "[" + v.map(function(x) { | |
return _g.showT.show(x); | |
}).join(", ") + "]"; | |
} | |
} | |
hots.instances.ArrayTApply = function(appM,funcM) { | |
this.appM = appM; | |
this.funcM = funcM; | |
}; | |
hots.instances.ArrayTApply.__name__ = true; | |
hots.instances.ArrayTApply.__interfaces__ = [hots.classes.Apply]; | |
hots.instances.ArrayTApply.prototype = { | |
apply: function(f,of) { | |
var f1 = function(x) { | |
return function(a) { | |
return scuts.core.Arrays.zipWith(x,a,function(x1,a1) { | |
return x1(a1); | |
}); | |
}; | |
}; | |
var newF = this.funcM.map(f,f1); | |
return this.appM.apply(newF,of); | |
} | |
} | |
hots.instances.ArrayTBind = function(monadM) { | |
this.monadM = monadM; | |
}; | |
hots.instances.ArrayTBind.__name__ = true; | |
hots.instances.ArrayTBind.__interfaces__ = [hots.classes.Bind]; | |
hots.instances.ArrayTBind.prototype = { | |
flatMap: function(val,f) { | |
var _g1 = this; | |
var f1 = function(a) { | |
var res = []; | |
var pushElems = function(x) { | |
var _g = 0; | |
while(_g < x.length) { | |
var e2 = x[_g]; | |
++_g; | |
res.push(e2); | |
} | |
}; | |
var _g = 0; | |
while(_g < a.length) { | |
var e1 = a[_g]; | |
++_g; | |
_g1.monadM.map(f(e1),pushElems); | |
} | |
return _g1.monadM.pure(res); | |
}; | |
return this.monadM.flatMap(val,f1); | |
} | |
} | |
hots.instances.ArrayTFunctor = function(functorM) { | |
this.functorM = functorM; | |
}; | |
hots.instances.ArrayTFunctor.__name__ = true; | |
hots.instances.ArrayTFunctor.__interfaces__ = [hots.classes.Functor]; | |
hots.instances.ArrayTFunctor.prototype = { | |
map: function(v,f) { | |
var f1 = function(x) { | |
return scuts.core.Arrays.map(x,f); | |
}; | |
return this.functorM.map(v,f1); | |
} | |
} | |
hots.instances.ArrayTPure = function(pureM) { | |
this.pureM = pureM; | |
}; | |
hots.instances.ArrayTPure.__name__ = true; | |
hots.instances.ArrayTPure.__interfaces__ = [hots.classes.Pure]; | |
hots.instances.ArrayTPure.prototype = { | |
pure: function(x) { | |
return this.pureM.pure([x]); | |
} | |
} | |
hots.instances.ArrayZero = function() { | |
}; | |
hots.instances.ArrayZero.__name__ = true; | |
hots.instances.ArrayZero.__interfaces__ = [hots.classes.Zero]; | |
hots.instances.ArrayZero.prototype = { | |
zero: function() { | |
return []; | |
} | |
} | |
hots.instances.ContBind = function() { | |
}; | |
hots.instances.ContBind.__name__ = true; | |
hots.instances.ContBind.__interfaces__ = [hots.classes.Bind]; | |
hots.instances.ContBind.prototype = { | |
flatMap: function(x,f) { | |
return scuts.core.Conts.flatMap(x,f); | |
} | |
} | |
hots.instances.ContFunctor = function() { | |
}; | |
hots.instances.ContFunctor.__name__ = true; | |
hots.instances.ContFunctor.__interfaces__ = [hots.classes.Functor]; | |
hots.instances.ContFunctor.prototype = { | |
map: function(x,f) { | |
return scuts.core.Conts.map(x,f); | |
} | |
} | |
hots.instances.DualSemigroup = function(s) { | |
this.semi = s; | |
}; | |
hots.instances.DualSemigroup.__name__ = true; | |
hots.instances.DualSemigroup.__interfaces__ = [hots.classes.Semigroup]; | |
hots.instances.DualSemigroup.prototype = { | |
append: function(a1,a2) { | |
return this.semi.append(a2,a1); | |
} | |
} | |
hots.instances.EitherEq = function(eqA,eqB) { | |
this.eqA = eqA; | |
this.eqB = eqB; | |
}; | |
hots.instances.EitherEq.__name__ = true; | |
hots.instances.EitherEq.__super__ = hots.classes.EqAbstract; | |
hots.instances.EitherEq.prototype = $extend(hots.classes.EqAbstract.prototype,{ | |
eq: function(a,b) { | |
return scuts.core.Eithers.eq(a,b,($_=this.eqA,$bind($_,$_.eq)),($_=this.eqB,$bind($_,$_.eq))); | |
} | |
}); | |
hots.instances.EitherSemigroup = function(semiL,semiR) { | |
this.semiL = semiL; | |
this.semiR = semiR; | |
}; | |
hots.instances.EitherSemigroup.__name__ = true; | |
hots.instances.EitherSemigroup.__interfaces__ = [hots.classes.Semigroup]; | |
hots.instances.EitherSemigroup.prototype = { | |
append: function(a1,a2) { | |
return scuts.core.Eithers.append(a1,a2,($_=this.semiL,$bind($_,$_.append)),($_=this.semiR,$bind($_,$_.append))); | |
} | |
} | |
hots.instances.EndoSemigroup = function() { | |
}; | |
hots.instances.EndoSemigroup.__name__ = true; | |
hots.instances.EndoSemigroup.__interfaces__ = [hots.classes.Semigroup]; | |
hots.instances.EndoSemigroup.prototype = { | |
append: function(a,b) { | |
return scuts.core.Function1s.compose(a,b); | |
} | |
} | |
hots.instances.KleisliArrow = function(m,cat) { | |
hots.classes.ArrowAbstract.call(this,cat); | |
this.m = m; | |
}; | |
hots.instances.KleisliArrow.__name__ = true; | |
hots.instances.KleisliArrow.__super__ = hots.classes.ArrowAbstract; | |
hots.instances.KleisliArrow.prototype = $extend(hots.classes.ArrowAbstract.prototype,{ | |
first: function(f) { | |
var _g = this; | |
return function(t) { | |
var f1 = f; | |
return _g.m.flatMap(_g.m.pure(t),function(t1) { | |
var d = f1(t1._1); | |
return _g.m.map(d,function(c) { | |
return scuts.core.Tup2.create(c,t1._2); | |
}); | |
}); | |
}; | |
} | |
,arr: function(f) { | |
return scuts.core.Function1s.compose(($_=this.m,$bind($_,$_.pure)),f); | |
} | |
}); | |
hots.instances.KleisliCategory = function(m) { | |
this.m = m; | |
}; | |
hots.instances.KleisliCategory.__name__ = true; | |
hots.instances.KleisliCategory.__super__ = hots.classes.CategoryAbstract; | |
hots.instances.KleisliCategory.prototype = $extend(hots.classes.CategoryAbstract.prototype,{ | |
dot: function(f,g) { | |
var _g = this; | |
var f1 = f; | |
var g1 = g; | |
var h = function(a) { | |
var c = g1(a); | |
return _g.m.flatMap(c,f1); | |
}; | |
return h; | |
} | |
,id: function(a) { | |
var _g = this; | |
return function(a1) { | |
return _g.m.pure(a1); | |
}; | |
} | |
}); | |
hots.instances.LazyTFunctor = function(f) { | |
this.functorT = f; | |
}; | |
hots.instances.LazyTFunctor.__name__ = true; | |
hots.instances.LazyTFunctor.__interfaces__ = [hots.classes.Functor]; | |
hots.instances.LazyTFunctor.prototype = { | |
map: function(x,f) { | |
var _g = this; | |
var z = x; | |
return function() { | |
return _g.functorT.map(z(),f); | |
}; | |
} | |
} | |
hots.instances.OptionEq = function(eqT) { | |
this.eqT = eqT; | |
}; | |
hots.instances.OptionEq.__name__ = true; | |
hots.instances.OptionEq.__super__ = hots.classes.EqAbstract; | |
hots.instances.OptionEq.prototype = $extend(hots.classes.EqAbstract.prototype,{ | |
eq: function(a,b) { | |
return scuts.core.Options.eq(a,b,($_=this.eqT,$bind($_,$_.eq))); | |
} | |
}); | |
hots.instances.OptionOrd = function(ordT,eq) { | |
hots.classes.OrdAbstract.call(this,eq); | |
this.ordT = ordT; | |
}; | |
hots.instances.OptionOrd.__name__ = true; | |
hots.instances.OptionOrd.__super__ = hots.classes.OrdAbstract; | |
hots.instances.OptionOrd.prototype = $extend(hots.classes.OrdAbstract.prototype,{ | |
compare: function(a,b) { | |
return scuts.core.Options.compareBy(a,b,($_=this.ordT,$bind($_,$_.compare))); | |
} | |
}); | |
hots.instances.OptionSemigroup = function(semi) { | |
this.semi = semi; | |
}; | |
hots.instances.OptionSemigroup.__name__ = true; | |
hots.instances.OptionSemigroup.__interfaces__ = [hots.classes.Semigroup]; | |
hots.instances.OptionSemigroup.prototype = { | |
append: function(a1,a2) { | |
return scuts.core.Options.append(a1,a2,($_=this.semi,$bind($_,$_.append))); | |
} | |
} | |
hots.instances.OptionShow = function(showT) { | |
this.showT = showT; | |
}; | |
hots.instances.OptionShow.__name__ = true; | |
hots.instances.OptionShow.__interfaces__ = [hots.classes.Show]; | |
hots.instances.OptionShow.prototype = { | |
show: function(v) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
var v_eSome_0 = $e[2]; | |
$r = "Some(" + $this.showT.show(v_eSome_0) + ")"; | |
break; | |
case 1: | |
$r = "None"; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
} | |
hots.instances.OptionTApply = function(applyM,functorM) { | |
this.functorM = functorM; | |
this.applyM = applyM; | |
}; | |
hots.instances.OptionTApply.__name__ = true; | |
hots.instances.OptionTApply.__interfaces__ = [hots.classes.Apply]; | |
hots.instances.OptionTApply.prototype = { | |
apply: function(f,val) { | |
var f1 = function(f2) { | |
return function(a) { | |
return scuts.core.Options.zipWith(f2,a,function(f11,a1) { | |
return f11(a1); | |
}); | |
}; | |
}; | |
var newF = this.functorM.map(f,f1); | |
return this.applyM.apply(newF,val); | |
} | |
} | |
hots.instances.OptionTBind = function(base) { | |
this.base = base; | |
}; | |
hots.instances.OptionTBind.__name__ = true; | |
hots.instances.OptionTBind.__interfaces__ = [hots.classes.Bind]; | |
hots.instances.OptionTBind.prototype = { | |
flatMap: function(val,f) { | |
var _g = this; | |
var f1 = function(a) { | |
return (function($this) { | |
var $r; | |
var $e = (a); | |
switch( $e[1] ) { | |
case 0: | |
var a_eSome_0 = $e[2]; | |
$r = f(a_eSome_0); | |
break; | |
case 1: | |
$r = _g.base.pure(scuts.core.Option.None); | |
break; | |
} | |
return $r; | |
}(this)); | |
}; | |
return this.base.flatMap(val,f1); | |
} | |
} | |
hots.instances.OptionTEmpty = function(pureM) { | |
this.pureM = pureM; | |
}; | |
hots.instances.OptionTEmpty.__name__ = true; | |
hots.instances.OptionTEmpty.__interfaces__ = [hots.classes.Empty]; | |
hots.instances.OptionTEmpty.prototype = { | |
empty: function() { | |
return this.pureM.pure(scuts.core.Option.None); | |
} | |
} | |
hots.instances.OptionTFunctor = function(functorM) { | |
this.functorM = functorM; | |
}; | |
hots.instances.OptionTFunctor.__name__ = true; | |
hots.instances.OptionTFunctor.__interfaces__ = [hots.classes.Functor]; | |
hots.instances.OptionTFunctor.prototype = { | |
map: function(v,f) { | |
var f1 = function(x) { | |
return scuts.core.Options.map(x,f); | |
}; | |
return this.functorM.map(v,f1); | |
} | |
} | |
hots.instances.OptionTPure = function(pureM) { | |
this.pureM = pureM; | |
}; | |
hots.instances.OptionTPure.__name__ = true; | |
hots.instances.OptionTPure.__interfaces__ = [hots.classes.Pure]; | |
hots.instances.OptionTPure.prototype = { | |
pure: function(x) { | |
return this.pureM.pure(scuts.core.Options.pure(x)); | |
} | |
} | |
hots.instances.OptionZero = function() { | |
}; | |
hots.instances.OptionZero.__name__ = true; | |
hots.instances.OptionZero.__interfaces__ = [hots.classes.Zero]; | |
hots.instances.OptionZero.prototype = { | |
zero: function() { | |
return scuts.core.Option.None; | |
} | |
} | |
hots.instances.StateApply = function() { | |
}; | |
hots.instances.StateApply.__name__ = true; | |
hots.instances.StateApply.__interfaces__ = [hots.classes.Apply]; | |
hots.instances.StateApply.prototype = { | |
apply: function(f,x) { | |
return function(s) { | |
var z1 = f(s); | |
var z2 = x(z1._1); | |
return scuts.core.Tup2.create(z2._1,z1._2(z2._2)); | |
}; | |
} | |
} | |
hots.instances.StateBind = function() { | |
}; | |
hots.instances.StateBind.__name__ = true; | |
hots.instances.StateBind.__interfaces__ = [hots.classes.Bind]; | |
hots.instances.StateBind.prototype = { | |
flatMap: function(x,f) { | |
return scuts.core.States.flatMap(x,f); | |
} | |
} | |
hots.instances.StateFunctor = function() { | |
}; | |
hots.instances.StateFunctor.__name__ = true; | |
hots.instances.StateFunctor.__interfaces__ = [hots.classes.Functor]; | |
hots.instances.StateFunctor.prototype = { | |
map: function(x,f) { | |
return scuts.core.States.map(x,f); | |
} | |
} | |
hots.instances.StatePure = function() { | |
}; | |
hots.instances.StatePure.__name__ = true; | |
hots.instances.StatePure.__interfaces__ = [hots.classes.Pure]; | |
hots.instances.StatePure.prototype = { | |
pure: function(x) { | |
return scuts.core.States.pure(x); | |
} | |
} | |
hots.instances.Tup2Eq = function(eq1,eq2) { | |
this.eq1 = eq1; | |
this.eq2 = eq2; | |
}; | |
hots.instances.Tup2Eq.__name__ = true; | |
hots.instances.Tup2Eq.__super__ = hots.classes.EqAbstract; | |
hots.instances.Tup2Eq.prototype = $extend(hots.classes.EqAbstract.prototype,{ | |
eq: function(a,b) { | |
return scuts.core.Tup2s.eq(a,b,($_=this.eq1,$bind($_,$_.eq)),($_=this.eq2,$bind($_,$_.eq))); | |
} | |
}); | |
hots.instances.Tup2Ord = function(ord1,ord2,eq) { | |
hots.classes.OrdAbstract.call(this,eq); | |
this.ord1 = ord1; | |
this.ord2 = ord2; | |
}; | |
hots.instances.Tup2Ord.__name__ = true; | |
hots.instances.Tup2Ord.__super__ = hots.classes.OrdAbstract; | |
hots.instances.Tup2Ord.prototype = $extend(hots.classes.OrdAbstract.prototype,{ | |
compare: function(a,b) { | |
return (function($this) { | |
var $r; | |
var _g = $this.ord1.compare(a._1,b._1); | |
$r = (function($this) { | |
var $r; | |
switch( (_g)[1] ) { | |
case 0: | |
$r = scuts.core.Ordering.LT; | |
break; | |
case 1: | |
$r = $this.ord2.compare(a._2,b._2); | |
break; | |
case 2: | |
$r = scuts.core.Ordering.GT; | |
break; | |
} | |
return $r; | |
}($this)); | |
return $r; | |
}(this)); | |
} | |
}); | |
hots.instances.Tup2Semigroup = function(s1,s2) { | |
this.s1 = s1; | |
this.s2 = s2; | |
}; | |
hots.instances.Tup2Semigroup.__name__ = true; | |
hots.instances.Tup2Semigroup.__interfaces__ = [hots.classes.Semigroup]; | |
hots.instances.Tup2Semigroup.prototype = { | |
append: function(a,b) { | |
return scuts.core.Tup2.create(this.s1.append(a._1,b._1),this.s2.append(a._2,b._2)); | |
} | |
} | |
hots.instances.Tup3Semigroup = function(s1,s2,s3) { | |
this.s1 = s1; | |
this.s2 = s2; | |
this.s3 = s3; | |
}; | |
hots.instances.Tup3Semigroup.__name__ = true; | |
hots.instances.Tup3Semigroup.__interfaces__ = [hots.classes.Semigroup]; | |
hots.instances.Tup3Semigroup.prototype = { | |
append: function(a,b) { | |
return scuts.core.Tup3.create(this.s1.append(a._1,b._1),this.s2.append(a._2,b._2),this.s3.append(a._3,b._3)); | |
} | |
} | |
hots.instances.ValidationApply = function(failureSemi) { | |
this.failureSemi = failureSemi; | |
}; | |
hots.instances.ValidationApply.__name__ = true; | |
hots.instances.ValidationApply.__interfaces__ = [hots.classes.Apply]; | |
hots.instances.ValidationApply.prototype = { | |
apply: function(f,of) { | |
return scuts.core.Validations.apply(of,f,($_=this.failureSemi,$bind($_,$_.append))); | |
} | |
} | |
hots.instances.ValidationBind = function() { | |
}; | |
hots.instances.ValidationBind.__name__ = true; | |
hots.instances.ValidationBind.__interfaces__ = [hots.classes.Bind]; | |
hots.instances.ValidationBind.prototype = { | |
flatMap: function(of,f) { | |
return (function($this) { | |
var $r; | |
var $e = (of); | |
switch( $e[1] ) { | |
case 0: | |
var o_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(o_eFailure_0); | |
break; | |
case 1: | |
var o_eSuccess_0 = $e[2]; | |
$r = f(o_eSuccess_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
} | |
hots.instances.ValidationEmpty = function(failureMonoid) { | |
this.failureMonoid = failureMonoid; | |
}; | |
hots.instances.ValidationEmpty.__name__ = true; | |
hots.instances.ValidationEmpty.__interfaces__ = [hots.classes.Empty]; | |
hots.instances.ValidationEmpty.prototype = { | |
empty: function() { | |
return scuts.core.Validation.Failure(this.failureMonoid.zero()); | |
} | |
} | |
hots.instances.ValidationEq = function(failureEq,successEq) { | |
this.failureEq = failureEq; | |
this.successEq = successEq; | |
}; | |
hots.instances.ValidationEq.__name__ = true; | |
hots.instances.ValidationEq.__super__ = hots.classes.EqAbstract; | |
hots.instances.ValidationEq.prototype = $extend(hots.classes.EqAbstract.prototype,{ | |
eq: function(a,b) { | |
return scuts.core.Validations.eq(a,b,($_=this.failureEq,$bind($_,$_.eq)),($_=this.successEq,$bind($_,$_.eq))); | |
} | |
}); | |
hots.instances.ValidationFunctor = function() { | |
}; | |
hots.instances.ValidationFunctor.__name__ = true; | |
hots.instances.ValidationFunctor.__interfaces__ = [hots.classes.Functor]; | |
hots.instances.ValidationFunctor.prototype = { | |
map: function(of,f) { | |
return scuts.core.Validations.map(of,f); | |
} | |
} | |
hots.instances.ValidationPure = function() { | |
}; | |
hots.instances.ValidationPure.__name__ = true; | |
hots.instances.ValidationPure.__interfaces__ = [hots.classes.Pure]; | |
hots.instances.ValidationPure.prototype = { | |
pure: function(x) { | |
return scuts.core.ValidationFromDynamic.toSuccess(x); | |
} | |
} | |
hots.instances.ValidationSemigroup = function(semiF,semiS) { | |
this.semiF = semiF; | |
this.semiS = semiS; | |
}; | |
hots.instances.ValidationSemigroup.__name__ = true; | |
hots.instances.ValidationSemigroup.__interfaces__ = [hots.classes.Semigroup]; | |
hots.instances.ValidationSemigroup.prototype = { | |
append: function(a1,a2) { | |
return scuts.core.Validations.append(a1,a2,($_=this.semiF,$bind($_,$_.append)),($_=this.semiS,$bind($_,$_.append))); | |
} | |
} | |
hots.instances.ValidationTApply = function(funcM,applyM) { | |
this.funcM = funcM; | |
this.applyM = applyM; | |
}; | |
hots.instances.ValidationTApply.__name__ = true; | |
hots.instances.ValidationTApply.__interfaces__ = [hots.classes.Apply]; | |
hots.instances.ValidationTApply.prototype = { | |
apply: function(f,val) { | |
var mapInner = function(f1) { | |
return function(a) { | |
return scuts.core.Validations.zipWith(f1,a,function(f11,a1) { | |
return f11(a1); | |
}); | |
}; | |
}; | |
var newF = this.funcM.map(f,mapInner); | |
return this.applyM.apply(newF,val); | |
} | |
} | |
hots.instances.ValidationTBind = function(base) { | |
this.base = base; | |
}; | |
hots.instances.ValidationTBind.__name__ = true; | |
hots.instances.ValidationTBind.__interfaces__ = [hots.classes.Bind]; | |
hots.instances.ValidationTBind.prototype = { | |
flatMap: function(val,f) { | |
var _g = this; | |
var f1 = function(a) { | |
return (function($this) { | |
var $r; | |
var $e = (a); | |
switch( $e[1] ) { | |
case 1: | |
var a_eSuccess_0 = $e[2]; | |
$r = f(a_eSuccess_0); | |
break; | |
case 0: | |
var a_eFailure_0 = $e[2]; | |
$r = _g.base.pure(scuts.core.Validation.Failure(a_eFailure_0)); | |
break; | |
} | |
return $r; | |
}(this)); | |
}; | |
return this.base.flatMap(val,f1); | |
} | |
} | |
hots.instances.ValidationTFunctor = function(functorM) { | |
this.functorM = functorM; | |
}; | |
hots.instances.ValidationTFunctor.__name__ = true; | |
hots.instances.ValidationTFunctor.__interfaces__ = [hots.classes.Functor]; | |
hots.instances.ValidationTFunctor.prototype = { | |
map: function(fa,f) { | |
var mapInner = function(x) { | |
return scuts.core.Validations.map(x,f); | |
}; | |
return this.functorM.map(fa,mapInner); | |
} | |
} | |
hots.instances.ValidationTPure = function(pureM) { | |
this.pureM = pureM; | |
}; | |
hots.instances.ValidationTPure.__name__ = true; | |
hots.instances.ValidationTPure.__interfaces__ = [hots.classes.Pure]; | |
hots.instances.ValidationTPure.prototype = { | |
pure: function(x) { | |
return this.pureM.pure(scuts.core.ValidationFromDynamic.toSuccess(x)); | |
} | |
} | |
hots.macros = {} | |
hots.macros.implicits = {} | |
hots.macros.implicits.Helper = function() { } | |
hots.macros.implicits.Helper.__name__ = true; | |
hots.macros.implicits.Helper.curry0 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.curry1 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.curry2 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.curry3 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.curry4 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.curry5 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.curry6 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.curry7 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.toImplicitObject = function(a) { | |
return null; | |
} | |
hots.macros.implicits.Helper.toImplicitObject0 = function(a) { | |
return null; | |
} | |
hots.macros.implicits.Helper.toImplicitObject1 = function(a) { | |
return null; | |
} | |
hots.macros.implicits.Helper.toImplicitObject2 = function(a) { | |
return null; | |
} | |
hots.macros.implicits.Helper.toImplicitObject3 = function(a) { | |
return null; | |
} | |
hots.macros.implicits.Helper.toImplicitObject4 = function(a) { | |
return null; | |
} | |
hots.macros.implicits.Helper.toImplicitObject5 = function(a) { | |
return null; | |
} | |
hots.macros.implicits.Helper.toImplicitObject6 = function(a) { | |
return null; | |
} | |
hots.macros.implicits.Helper.first = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.typeAsParam = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.ret0 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.ret1 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.ret2 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.ret3 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.ret4 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.ret5 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.ret6 = function(f) { | |
return null; | |
} | |
hots.macros.implicits.Helper.typed0 = function(f,x) { | |
return f; | |
} | |
hots.macros.implicits.Helper.typed1 = function(f,x) { | |
return f; | |
} | |
hots.macros.implicits.Helper.typed2 = function(f,x) { | |
return f; | |
} | |
hots.macros.implicits.Helper.typed3 = function(f,x) { | |
return f; | |
} | |
hots.macros.implicits.Helper.typed4 = function(f,x) { | |
return f; | |
} | |
hots.macros.implicits.Helper.typed5 = function(f,x) { | |
return f; | |
} | |
hots.macros.implicits.Helper.typed6 = function(f,x) { | |
return f; | |
} | |
hots.macros.syntax = {} | |
hots.macros.syntax.DoHelper = function() { } | |
hots.macros.syntax.DoHelper.__name__ = true; | |
hots.macros.syntax.DoHelper.getMonadEmpty = function(o) { | |
return null; | |
} | |
hots.macros.syntax.DoHelper.getMonad = function(o) { | |
return null; | |
} | |
var js = {} | |
js.Boot = function() { } | |
js.Boot.__name__ = true; | |
js.Boot.__string_rec = function(o,s) { | |
if(o == null) return "null"; | |
if(s.length >= 5) return "<...>"; | |
var t = typeof(o); | |
if(t == "function" && (o.__name__ || o.__ename__)) t = "object"; | |
switch(t) { | |
case "object": | |
if(o instanceof Array) { | |
if(o.__enum__) { | |
if(o.length == 2) return o[0]; | |
var str = o[0] + "("; | |
s += "\t"; | |
var _g1 = 2, _g = o.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
if(i != 2) str += "," + js.Boot.__string_rec(o[i],s); else str += js.Boot.__string_rec(o[i],s); | |
} | |
return str + ")"; | |
} | |
var l = o.length; | |
var i; | |
var str = "["; | |
s += "\t"; | |
var _g = 0; | |
while(_g < l) { | |
var i1 = _g++; | |
str += (i1 > 0?",":"") + js.Boot.__string_rec(o[i1],s); | |
} | |
str += "]"; | |
return str; | |
} | |
var tostr; | |
try { | |
tostr = o.toString; | |
} catch( e ) { | |
return "???"; | |
} | |
if(tostr != null && tostr != Object.toString) { | |
var s2 = o.toString(); | |
if(s2 != "[object Object]") return s2; | |
} | |
var k = null; | |
var str = "{\n"; | |
s += "\t"; | |
var hasp = o.hasOwnProperty != null; | |
for( var k in o ) { ; | |
if(hasp && !o.hasOwnProperty(k)) { | |
continue; | |
} | |
if(k == "prototype" || k == "__class__" || k == "__super__" || k == "__interfaces__" || k == "__properties__") { | |
continue; | |
} | |
if(str.length != 2) str += ", \n"; | |
str += s + k + " : " + js.Boot.__string_rec(o[k],s); | |
} | |
s = s.substring(1); | |
str += "\n" + s + "}"; | |
return str; | |
case "function": | |
return "<function>"; | |
case "string": | |
return o; | |
default: | |
return String(o); | |
} | |
} | |
js.Browser = function() { } | |
js.Browser.__name__ = true; | |
var scuts = {} | |
scuts.Scuts = function() { } | |
scuts.Scuts.__name__ = true; | |
scuts.Scuts.id = function(a) { | |
return a; | |
} | |
scuts.Scuts.posInfos = function(p) { | |
return p; | |
} | |
scuts.Scuts.abstractMethod = function() { | |
return scuts.Scuts.error("Scuts.abstractMethod: This method is abstract and must be overriden",{ fileName : "Scuts.hx", lineNumber : 26, className : "scuts.Scuts", methodName : "abstractMethod"}); | |
} | |
scuts.Scuts.notImplemented = function(posInfos) { | |
return scuts.Scuts.error("Scuts.notImplemented: This method is not yet implemented",posInfos); | |
} | |
scuts.Scuts.unexpected = function(posInfos) { | |
return scuts.Scuts.error("Scuts.unexpected: This error shoud never occur, please inform the library author to fix this.",posInfos); | |
} | |
scuts.Scuts.error = function(msg,posInfos) { | |
throw msg; | |
return null; | |
} | |
scuts.core = {} | |
scuts.core.Arrays = function() { } | |
scuts.core.Arrays.__name__ = true; | |
scuts.core.Arrays.catOptions = function(a) { | |
var res = []; | |
var _g = 0; | |
while(_g < a.length) { | |
var e = a[_g]; | |
++_g; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eSome_0 = $e[2]; | |
res.push(e_eSome_0); | |
break; | |
case 1: | |
break; | |
} | |
} | |
return res; | |
} | |
scuts.core.Arrays.difference = function(a,b,eq) { | |
var res = []; | |
var _g = 0; | |
while(_g < a.length) { | |
var e = [a[_g]]; | |
++_g; | |
if(!scuts.core.Arrays.any(b,(function(e) { | |
return function(x) { | |
return eq(x,e[0]); | |
}; | |
})(e))) res.push(e[0]); | |
} | |
return res; | |
} | |
scuts.core.Arrays.isEmpty = function(a) { | |
return a.length == 0; | |
} | |
scuts.core.Arrays.intersect = function(a,b,eq) { | |
var res = []; | |
var _g = 0; | |
while(_g < a.length) { | |
var e = [a[_g]]; | |
++_g; | |
if(scuts.core.Arrays.any(b,(function(e) { | |
return function(x) { | |
return eq(x,e[0]); | |
}; | |
})(e))) res.push(e[0]); | |
} | |
return res; | |
} | |
scuts.core.Arrays.union = function(a,b,eq) { | |
var res = []; | |
var _g = 0; | |
while(_g < a.length) { | |
var e = a[_g]; | |
++_g; | |
res.push(e); | |
} | |
var _g = 0; | |
while(_g < b.length) { | |
var e1 = [b[_g]]; | |
++_g; | |
if(!scuts.core.Arrays.any(res,(function(e1) { | |
return function(x) { | |
return eq(x,e1[0]); | |
}; | |
})(e1))) res.push(e1[0]); | |
} | |
return res; | |
} | |
scuts.core.Arrays.eq = function(a1,a2,eqElem) { | |
if(a1.length != a2.length) return false; | |
var _g1 = 0, _g = a1.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
if(!eqElem(a1[i],a2[i])) return false; | |
} | |
return true; | |
} | |
scuts.core.Arrays.shuffle = function(arr) { | |
var res = []; | |
var cp = arr.slice(); | |
while(cp.length > 0) { | |
var randIndex = Math.floor(Math.random() * cp.length); | |
res.push(cp.splice(randIndex,1)[0]); | |
} | |
return res; | |
} | |
scuts.core.Arrays.toIntHash = function(arr,key) { | |
var h = new haxe.ds.IntMap(); | |
var _g = 0; | |
while(_g < arr.length) { | |
var a = arr[_g]; | |
++_g; | |
h.set(key(a),a); | |
} | |
return h; | |
} | |
scuts.core.Arrays.dropToArray = function(a,num) { | |
return scuts.core.Arrays.drop(a,num); | |
} | |
scuts.core.Arrays.all = function(a,pred) { | |
var s = true; | |
var _g = 0; | |
while(_g < a.length) { | |
var e = a[_g]; | |
++_g; | |
if(!pred(e)) { | |
s = false; | |
break; | |
} | |
} | |
return s; | |
} | |
scuts.core.Arrays.any = function(a,pred) { | |
var _g = 0; | |
while(_g < a.length) { | |
var e = a[_g]; | |
++_g; | |
if(pred(e)) return true; | |
} | |
return false; | |
} | |
scuts.core.Arrays.drop = function(a,num) { | |
var res = []; | |
var i = 0; | |
while(i < num && i < a.length) i++; | |
while(i < a.length) { | |
res.push(a[i]); | |
i++; | |
} | |
return res; | |
} | |
scuts.core.Arrays.dropWhileWithIndex = function(a,f) { | |
var res = []; | |
var i = 0; | |
while(i < a.length && f(a[i],i)) i++; | |
while(i < a.length) { | |
res.push(a[i]); | |
i++; | |
} | |
return res; | |
} | |
scuts.core.Arrays.dropWhile = function(a,f) { | |
var res = []; | |
var i = 0; | |
while(i < a.length && f(a[i])) i++; | |
while(i < a.length) { | |
res.push(a[i]); | |
i++; | |
} | |
return res; | |
} | |
scuts.core.Arrays.filterWithOption = function(a,filter) { | |
var res = []; | |
var _g = 0; | |
while(_g < a.length) { | |
var e = a[_g]; | |
++_g; | |
var _g1 = filter(e); | |
var $e = (_g1); | |
switch( $e[1] ) { | |
case 0: | |
var _g1_eSome_0 = $e[2]; | |
res.push(_g1_eSome_0); | |
break; | |
case 1: | |
break; | |
} | |
} | |
return res; | |
} | |
scuts.core.Arrays.filter = function(a,filter) { | |
var res = []; | |
var _g = 0; | |
while(_g < a.length) { | |
var e = a[_g]; | |
++_g; | |
if(filter(e)) res.push(e); | |
} | |
return res; | |
} | |
scuts.core.Arrays.filterWithIndex = function(a,filter) { | |
var res = []; | |
var _g1 = 0, _g = a.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
var e = a[i]; | |
if(filter(e,i)) res.push(e); | |
} | |
return res; | |
} | |
scuts.core.Arrays.firstOption = function(a) { | |
return a.length == 0?scuts.core.Option.None:scuts.core.Option.Some(a[0]); | |
} | |
scuts.core.Arrays.first = function(a) { | |
return a.length == 0?scuts.Scuts.error("Array a has no first element",{ fileName : "Arrays.hx", lineNumber : 244, className : "scuts.core.Arrays", methodName : "first"}):a[0]; | |
} | |
scuts.core.Arrays.flatMap = function(w,f) { | |
var res = []; | |
var _g = 0; | |
while(_g < w.length) { | |
var i = w[_g]; | |
++_g; | |
var _g1 = 0, _g2 = f(i); | |
while(_g1 < _g2.length) { | |
var j = _g2[_g1]; | |
++_g1; | |
res.push(j); | |
} | |
} | |
return res; | |
} | |
scuts.core.Arrays.flatten = function(a) { | |
var res = []; | |
var _g = 0; | |
while(_g < a.length) { | |
var a1 = a[_g]; | |
++_g; | |
var _g1 = 0; | |
while(_g1 < a1.length) { | |
var e = a1[_g1]; | |
++_g1; | |
res.push(e); | |
} | |
} | |
return res; | |
} | |
scuts.core.Arrays.each = function(a,f) { | |
var _g = 0; | |
while(_g < a.length) { | |
var e = a[_g]; | |
++_g; | |
f(e); | |
} | |
} | |
scuts.core.Arrays.intersperse = function(a,b) { | |
return a.length == 0?[]:(function($this) { | |
var $r; | |
var res = [a[0]]; | |
{ | |
var _g1 = 1, _g = a.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
res.push(b); | |
res.push(a[i]); | |
} | |
} | |
$r = res; | |
return $r; | |
}(this)); | |
} | |
scuts.core.Arrays.foldRight = function(arr,acc,f) { | |
var rev = scuts.core.Arrays.reversed(arr); | |
var _g1 = 0, _g = rev.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
acc = f(rev[i],acc); | |
} | |
return acc; | |
} | |
scuts.core.Arrays.foldRightWithIndex = function(arr,acc,f) { | |
var rev = scuts.core.Arrays.reversed(arr); | |
var _g1 = 0, _g = rev.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
acc = f(rev[i],acc,rev.length - 1 - i); | |
} | |
return acc; | |
} | |
scuts.core.Arrays.foldLeft = function(arr,acc,f) { | |
var _g1 = 0, _g = arr.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
acc = f(acc,arr[i]); | |
} | |
return acc; | |
} | |
scuts.core.Arrays.foldLeftWithIndex = function(arr,acc,f) { | |
var _g1 = 0, _g = arr.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
acc = f(acc,arr[i],i); | |
} | |
return acc; | |
} | |
scuts.core.Arrays.last = function(arr) { | |
return arr.length == 0?scuts.Scuts.error("cannot get last from empty array",{ fileName : "Arrays.hx", lineNumber : 336, className : "scuts.core.Arrays", methodName : "last"}):arr[arr.length - 1]; | |
} | |
scuts.core.Arrays.lastOption = function(arr) { | |
return arr.length == 0?scuts.core.Option.None:scuts.core.Option.Some(arr[arr.length - 1]); | |
} | |
scuts.core.Arrays.map = function(arr,f) { | |
var r = []; | |
var _g = 0; | |
while(_g < arr.length) { | |
var i = arr[_g]; | |
++_g; | |
r.push(f(i)); | |
} | |
return r; | |
} | |
scuts.core.Arrays.mapWithIndex = function(arr,f) { | |
var r = []; | |
var _g1 = 0, _g = arr.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
r.push(f(arr[i],i)); | |
} | |
return r; | |
} | |
scuts.core.Arrays.reduceLeft = function(a,f,first) { | |
if(a.length == 0) scuts.Scuts.error("Cannot reduce an empty Array",{ fileName : "Arrays.hx", lineNumber : 367, className : "scuts.core.Arrays", methodName : "reduceLeft"}); | |
var acc = first(a[0]); | |
var _g1 = 1, _g = a.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
acc = f(acc,a[i]); | |
} | |
return acc; | |
} | |
scuts.core.Arrays.reduceLeftWithIndex = function(a,f,first) { | |
if(a.length == 0) scuts.Scuts.error("Cannot reduce an empty Array",{ fileName : "Arrays.hx", lineNumber : 379, className : "scuts.core.Arrays", methodName : "reduceLeftWithIndex"}); | |
var acc = first(a[0]); | |
var _g1 = 1, _g = a.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
acc = f(acc,a[i],i); | |
} | |
return acc; | |
} | |
scuts.core.Arrays.some = function(arr,e) { | |
var _g = 0; | |
while(_g < arr.length) { | |
var i = arr[_g]; | |
++_g; | |
if(e(i)) return scuts.core.Option.Some(i); | |
} | |
return scuts.core.Option.None; | |
} | |
scuts.core.Arrays.someWithIndex = function(arr,p) { | |
var _g1 = 0, _g = arr.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
var elem = arr[i]; | |
if(p(elem)) return scuts.core.Option.Some(scuts.core.Tup2.create(elem,i)); | |
} | |
return scuts.core.Option.None; | |
} | |
scuts.core.Arrays.findIndex = function(arr,p) { | |
var _g1 = 0, _g = arr.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
if(p(arr[i])) return scuts.core.Option.Some(i); | |
} | |
return scuts.core.Option.None; | |
} | |
scuts.core.Arrays.findLastIndex = function(arr,p) { | |
var i = arr.length; | |
while(--i > -1) if(p(arr[i])) return scuts.core.Option.Some(i); | |
return scuts.core.Option.None; | |
} | |
scuts.core.Arrays.reduceRight = function(a,f,first) { | |
if(a.length == 0) throw "Cannot reduce an empty Array"; | |
var a1 = scuts.core.Arrays.reversed(a); | |
var acc = first(a1[0]); | |
var _g1 = 1, _g = a1.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
acc = f(a1[i],acc); | |
} | |
return acc; | |
} | |
scuts.core.Arrays.reduceRightWithIndex = function(a,f,first) { | |
if(a.length == 0) throw "Cannot reduce an empty Array"; | |
var a1 = scuts.core.Arrays.reversed(a); | |
var acc = first(a1[0]); | |
var _g1 = 1, _g = a1.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
acc = f(a1[i],acc,a1.length - i); | |
} | |
return acc; | |
} | |
scuts.core.Arrays.reversed = function(a) { | |
var c = a.length; | |
var res = []; | |
var _g = 0; | |
while(_g < a.length) { | |
var e = a[_g]; | |
++_g; | |
res[--c] = e; | |
} | |
return res; | |
} | |
scuts.core.Arrays.size = function(arr) { | |
return arr.length; | |
} | |
scuts.core.Arrays.nub = function(a,eq) { | |
var r = []; | |
var _g = 0; | |
while(_g < a.length) { | |
var e = [a[_g]]; | |
++_g; | |
if(!scuts.core.Arrays.any(r,(function(e) { | |
return function(x) { | |
return eq(x,e[0]); | |
}; | |
})(e))) r.push(e[0]); | |
} | |
return r; | |
} | |
scuts.core.Arrays.take = function(it,numElements) { | |
var res = []; | |
var _g1 = 0, _g = it.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
if(i == numElements) break; | |
res.push(it[i]); | |
} | |
return res; | |
} | |
scuts.core.Arrays.zipWith = function(arr1,arr2,f) { | |
var min = scuts.core.Ints.min(arr1.length,arr2.length); | |
var res = []; | |
var _g = 0; | |
while(_g < min) { | |
var i = _g++; | |
res.push(f(arr1[i],arr2[i])); | |
} | |
return res; | |
} | |
scuts.core.Arrays.zipWithWhileC = function(arr1,arr2,f,cond) { | |
var min = scuts.core.Ints.min(arr1.length,arr2.length); | |
var res = []; | |
var _g = 0; | |
while(_g < min) { | |
var i = _g++; | |
var v = f(arr1[i],arr2[i]); | |
if(cond(v)) res.push(f(arr1[i],arr2[i])); else break; | |
} | |
return res; | |
} | |
scuts.core.Arrays.zipFoldLeftWhile = function(arr1,arr2,f,cond,init) { | |
var min = scuts.core.Ints.min(arr1.length,arr2.length); | |
var res = init; | |
var _g = 0; | |
while(_g < min) { | |
var i = _g++; | |
if(cond(res)) res = f(res,arr1[i],arr2[i]); else break; | |
} | |
return res; | |
} | |
scuts.core.Arrays.zipFoldLeft = function(arr1,arr2,f,init) { | |
var min = scuts.core.Ints.min(arr1.length,arr2.length); | |
var res = init; | |
var _g = 0; | |
while(_g < min) { | |
var i = _g++; | |
res = f(res,arr1[i],arr2[i]); | |
} | |
return res; | |
} | |
scuts.core.Arrays.zipWith2 = function(arr1,arr2,arr3,f) { | |
var min = scuts.core.Ints.min(scuts.core.Ints.min(arr1.length,arr2.length),arr3.length); | |
var res = []; | |
var _g = 0; | |
while(_g < min) { | |
var i = _g++; | |
res.push(f(arr1[i],arr2[i],arr3[i])); | |
} | |
return res; | |
} | |
scuts.core.Arrays.zip = function(arr1,arr2) { | |
var min = scuts.core.Ints.min(arr1.length,arr2.length); | |
var res = []; | |
var _g = 0; | |
while(_g < min) { | |
var i = _g++; | |
res.push(scuts.core.Tup2.create(arr1[i],arr2[i])); | |
} | |
return res; | |
} | |
scuts.core.Arrays.cons = function(a,e) { | |
var cp = a.slice(); | |
cp.unshift(e); | |
return cp; | |
} | |
scuts.core.Arrays.appendElem = function(a,e) { | |
return a.concat([e]); | |
} | |
scuts.core.Arrays.append = function(a,b) { | |
return a.concat(b); | |
} | |
scuts.core.Arrays.insertElemAt = function(a,e,index) { | |
var cp = a.slice(); | |
cp.splice(index,0,e); | |
return cp; | |
} | |
scuts.core.Arrays.replaceElemAt = function(a,e,index) { | |
var res = []; | |
var _g1 = 0, _g = a.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
if(i == index) res.push(e); else res.push(a[i]); | |
} | |
return res; | |
} | |
scuts.core.Arrays.removeElem = function(a,e,equals) { | |
equals = equals != null?equals:function(x1,x2) { | |
return x1 == x2; | |
}; | |
var res = []; | |
var _g = 0; | |
while(_g < a.length) { | |
var i = a[_g]; | |
++_g; | |
if(!equals(i,e)) res.push(i); | |
} | |
return res; | |
} | |
scuts.core.Arrays.removeElemAt = function(a,at) { | |
var res = []; | |
var _g1 = 0, _g = a.length; | |
while(_g1 < _g) { | |
var i = _g1++; | |
if(i != at) res.push(a[i]); | |
} | |
return res; | |
} | |
scuts.core.Arrays.removeLast = function(a) { | |
return a.length > 0?(function($this) { | |
var $r; | |
var res = a.slice(); | |
res.pop(); | |
$r = res; | |
return $r; | |
}(this)):a; | |
} | |
scuts.core.Arrays.removeFirst = function(a) { | |
return scuts.core.Arrays.drop(a,1); | |
} | |
scuts.core.Arrays.flatMapWithFilter = function(a,fmap,filter) { | |
var res = []; | |
var _g = 0; | |
while(_g < a.length) { | |
var i = a[_g]; | |
++_g; | |
if(filter(i)) { | |
var _g1 = 0, _g2 = fmap(i); | |
while(_g1 < _g2.length) { | |
var j = _g2[_g1]; | |
++_g1; | |
res.push(j); | |
} | |
} | |
} | |
return res; | |
} | |
scuts.core.Arrays.mapWithFilter = function(a,map,filter) { | |
var r = []; | |
var _g = 0; | |
while(_g < a.length) { | |
var i = a[_g]; | |
++_g; | |
if(filter(i)) r.push(map(i)); | |
} | |
return r; | |
} | |
scuts.core.Arrays.fromIterable = function(a) { | |
var r = []; | |
var $it0 = $iterator(a)(); | |
while( $it0.hasNext() ) { | |
var i = $it0.next(); | |
r.push(i); | |
} | |
return r; | |
} | |
scuts.core.Conts = function() { } | |
scuts.core.Conts.__name__ = true; | |
scuts.core.Conts.map = function(x,f) { | |
return function(z) { | |
return x(scuts.core.Function1s.compose(z,f)); | |
}; | |
} | |
scuts.core.Conts.flatMap = function(x,f) { | |
return function(z) { | |
return x(function(b) { | |
return (f(b))(z); | |
}); | |
}; | |
} | |
scuts.core.Conts.pure = function(x) { | |
return function(z) { | |
return z(x); | |
}; | |
} | |
scuts.core.Conts.apply = function(f,v) { | |
var z = function(g) { | |
return scuts.core.Conts.map(v,function(x) { | |
return g(x); | |
}); | |
}; | |
return scuts.core.Conts.flatMap(f,z); | |
} | |
scuts.core.Dynamics = function() { } | |
scuts.core.Dynamics.__name__ = true; | |
scuts.core.Dynamics.nullOrError = function(v,err) { | |
return v != null?v:scuts.Scuts.error(err,{ fileName : "Dynamics.hx", lineNumber : 11, className : "scuts.core.Dynamics", methodName : "nullOrError"}); | |
} | |
scuts.core.Dynamics.nullToArray = function(v) { | |
return v != null?[v]:[]; | |
} | |
scuts.core.Dynamics.nullGetOrElseConst = function(v,elseValue) { | |
return v != null?v:elseValue; | |
} | |
scuts.core.Dynamics.nullGetOrElse = function(v,elseValue) { | |
return v != null?v:elseValue(); | |
} | |
scuts.core.Dynamics.isObject = function(v) { | |
return Reflect.isObject(v); | |
} | |
scuts.core.Dynamics.thunk = function(o) { | |
return function() { | |
return o; | |
}; | |
} | |
scuts.core.Dynamics.nullEq = function(v1,v2,eq) { | |
return v1 == null && v2 == null || v1 != null && v2 != null && eq(v1,v2); | |
} | |
scuts.core.Either = { __ename__ : true, __constructs__ : ["Left","Right"] } | |
scuts.core.Either.Left = function(l) { var $x = ["Left",0,l]; $x.__enum__ = scuts.core.Either; $x.toString = $estr; return $x; } | |
scuts.core.Either.Right = function(r) { var $x = ["Right",1,r]; $x.__enum__ = scuts.core.Either; $x.toString = $estr; return $x; } | |
scuts.core.EitherConvert = function() { } | |
scuts.core.EitherConvert.__name__ = true; | |
scuts.core.EitherConvert.nullToEither = function(v,left) { | |
return v == null?scuts.core.Either.Left(left):scuts.core.Either.Right(v); | |
} | |
scuts.core.EitherConvert.toLeft = function(l) { | |
return scuts.core.Either.Left(l); | |
} | |
scuts.core.EitherConvert.toRight = function(r) { | |
return scuts.core.Either.Right(r); | |
} | |
scuts.core.Eithers = function() { } | |
scuts.core.Eithers.__name__ = true; | |
scuts.core.Eithers.append = function(a1,a2,appendLeft,appendRight) { | |
return (function($this) { | |
var $r; | |
var $e = (a1); | |
switch( $e[1] ) { | |
case 1: | |
var a1_eRight_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (a2); | |
switch( $e[1] ) { | |
case 1: | |
var a2_eRight_0 = $e[2]; | |
$r = scuts.core.Either.Right(appendRight(a1_eRight_0,a2_eRight_0)); | |
break; | |
case 0: | |
var a2_eLeft_0 = $e[2]; | |
$r = scuts.core.Either.Left(a2_eLeft_0); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
case 0: | |
var a1_eLeft_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (a2); | |
switch( $e[1] ) { | |
case 1: | |
$r = scuts.core.Either.Left(a1_eLeft_0); | |
break; | |
case 0: | |
var a2_eLeft_0 = $e[2]; | |
$r = scuts.core.Either.Left(appendLeft(a1_eLeft_0,a2_eLeft_0)); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.eq = function(a,b,eqA,eqB) { | |
return (function($this) { | |
var $r; | |
var $e = (a); | |
switch( $e[1] ) { | |
case 0: | |
var a_eLeft_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (b); | |
switch( $e[1] ) { | |
case 0: | |
var b_eLeft_0 = $e[2]; | |
$r = eqA(a_eLeft_0,b_eLeft_0); | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
case 1: | |
var a_eRight_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (b); | |
switch( $e[1] ) { | |
case 0: | |
$r = false; | |
break; | |
case 1: | |
var b_eRight_0 = $e[2]; | |
$r = eqB(a_eRight_0,b_eRight_0); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.applyLeft = function(e,f) { | |
return (function($this) { | |
var $r; | |
var $e = (f); | |
switch( $e[1] ) { | |
case 0: | |
var f_eLeft_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = scuts.core.Either.Left(f_eLeft_0(e_eLeft_0)); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = scuts.core.Either.Right(e_eRight_0); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
case 1: | |
var f_eRight_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
$r = scuts.core.Either.Right(f_eRight_0); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = scuts.core.Either.Right(e_eRight_0); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.applyRight = function(e,f) { | |
return (function($this) { | |
var $r; | |
var $e = (f); | |
switch( $e[1] ) { | |
case 0: | |
var f_eLeft_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = scuts.core.Either.Left(e_eLeft_0); | |
break; | |
case 1: | |
$r = scuts.core.Either.Left(f_eLeft_0); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
case 1: | |
var f_eRight_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = scuts.core.Either.Left(e_eLeft_0); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = scuts.core.Either.Right(f_eRight_0(e_eRight_0)); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.bool = function(e) { | |
return (function($this) { | |
var $r; | |
switch( (e)[1] ) { | |
case 0: | |
$r = false; | |
break; | |
case 1: | |
$r = true; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.getOrElse = function(e,handler) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = handler(e_eLeft_0); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = e_eRight_0; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.orElse = function(e,left) { | |
return (function($this) { | |
var $r; | |
switch( (e)[1] ) { | |
case 0: | |
$r = left(); | |
break; | |
case 1: | |
$r = e; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.extractLeft = function(e) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = e_eLeft_0; | |
break; | |
case 1: | |
$r = scuts.Scuts.error("Either has no Left value",{ fileName : "Eithers.hx", lineNumber : 124, className : "scuts.core.Eithers", methodName : "extractLeft"}); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.extractRight = function(e) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
$r = scuts.Scuts.error("Either has no Right value",{ fileName : "Eithers.hx", lineNumber : 132, className : "scuts.core.Eithers", methodName : "extractRight"}); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = e_eRight_0; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.optionLeft = function(e) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = scuts.core.Option.Some(e_eLeft_0); | |
break; | |
case 1: | |
$r = scuts.core.Option.None; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.ifLeft = function(e,f) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
$r = f(); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = scuts.core.Either.Right(e_eRight_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.ifRight = function(e,f) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = scuts.core.Either.Left(e_eLeft_0); | |
break; | |
case 1: | |
$r = f(); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.optionRight = function(e) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
$r = scuts.core.Option.None; | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = scuts.core.Option.Some(e_eRight_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.isLeft = function(e) { | |
return (function($this) { | |
var $r; | |
switch( (e)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.isRight = function(e) { | |
return !scuts.core.Eithers.isLeft(e); | |
} | |
scuts.core.Eithers.flatMap = function(e,fl,fr) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = fl(e_eLeft_0); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = fr(e_eRight_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.flatMapLeft = function(e,f) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = f(e_eLeft_0); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = scuts.core.Either.Right(e_eRight_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.flatMapRight = function(e,f) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = scuts.core.Either.Left(e_eLeft_0); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = f(e_eRight_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.flatten = function(e) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = e_eLeft_0; | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = e_eRight_0; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.flattenLeft = function(e) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = e_eLeft_0; | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = scuts.core.Either.Right(e_eRight_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.flattenRight = function(e) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = scuts.core.Either.Left(e_eLeft_0); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = e_eRight_0; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.mapLeft = function(e,f) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = scuts.core.Either.Left(f(e_eLeft_0)); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = scuts.core.Either.Right(e_eRight_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.mapRight = function(e,f) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = scuts.core.Either.Left(e_eLeft_0); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = scuts.core.Either.Right(f(e_eRight_0)); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.map = function(e,left,right) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = scuts.core.Either.Left(left(e_eLeft_0)); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = scuts.core.Either.Right(right(e_eRight_0)); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Eithers.rightProjection = function(e) { | |
return e; | |
} | |
scuts.core.Eithers.leftProjection = function(e) { | |
return e; | |
} | |
scuts.core.LeftProjections = function() { } | |
scuts.core.LeftProjections.__name__ = true; | |
scuts.core.LeftProjections.either = function(e) { | |
return e; | |
} | |
scuts.core.LeftProjections.eitherF = function(e) { | |
return e; | |
} | |
scuts.core.LeftProjections.rightProjection = function(e) { | |
return scuts.core.LeftProjections.rightProjection(e); | |
} | |
scuts.core.LeftProjections.flatMap = function(e,f) { | |
return scuts.core.RightProjections.leftProjection(scuts.core.Eithers.flatMapLeft(e,f)); | |
} | |
scuts.core.LeftProjections.map = function(e,f) { | |
return scuts.core.RightProjections.leftProjection(scuts.core.Eithers.mapLeft(e,f)); | |
} | |
scuts.core.LeftProjections.apply = function(e,f) { | |
return scuts.core.RightProjections.leftProjection(scuts.core.Eithers.applyLeft(e,f)); | |
} | |
scuts.core.RightProjections = function() { } | |
scuts.core.RightProjections.__name__ = true; | |
scuts.core.RightProjections.either = function(e) { | |
return e; | |
} | |
scuts.core.RightProjections.eitherF = function(e) { | |
return e; | |
} | |
scuts.core.RightProjections.leftProjection = function(e) { | |
return scuts.core.RightProjections.leftProjection(e); | |
} | |
scuts.core.RightProjections.flatMap = function(e,f) { | |
return scuts.core.LeftProjections.rightProjection(scuts.core.Eithers.flatMapRight(e,f)); | |
} | |
scuts.core.RightProjections.map = function(e,f) { | |
return scuts.core.LeftProjections.rightProjection(scuts.core.Eithers.mapRight(e,f)); | |
} | |
scuts.core.RightProjections.apply = function(e,f) { | |
return scuts.core.LeftProjections.rightProjection(scuts.core.Eithers.applyRight(e,f)); | |
} | |
scuts.core.Floats = function() { } | |
scuts.core.Floats.__name__ = true; | |
scuts.core.Floats.eq = function(a,b) { | |
var diff = a - b; | |
return diff >= 0.0 && diff < 1e-5 || diff <= 0.0 && diff > -1e-05; | |
} | |
scuts.core.Floats.max = function(a,b) { | |
return a > b?a:b; | |
} | |
scuts.core.Floats.min = function(a,b) { | |
return a < b?a:b; | |
} | |
scuts.core.Floats.round = function(v) { | |
return Math.round(v); | |
} | |
scuts.core.Floats.ceil = function(v) { | |
return Math.ceil(v); | |
} | |
scuts.core.Floats.floor = function(v) { | |
return Math.floor(v); | |
} | |
scuts.core.Floats.abs = function(v) { | |
return Math.abs(v); | |
} | |
scuts.core.Function0s = function() { } | |
scuts.core.Function0s.__name__ = true; | |
scuts.core.Function0s.map = function(a,f) { | |
return function() { | |
return f(a()); | |
}; | |
} | |
scuts.core.Function0s.flatMap = function(a,f) { | |
return function() { | |
return (f(a()))(); | |
}; | |
} | |
scuts.core.Function0s.pure = function(a) { | |
return function() { | |
return a; | |
}; | |
} | |
scuts.core.Function0s.toEffect = function(f) { | |
return function() { | |
f(); | |
}; | |
} | |
scuts.core.Function0s.promote = function(f) { | |
return function(x) { | |
return f(); | |
}; | |
} | |
scuts.core.Function1Opts = function() { } | |
scuts.core.Function1Opts.__name__ = true; | |
scuts.core.Function1Opts._0_ = function(f) { | |
return function() { | |
return f(); | |
}; | |
} | |
scuts.core.Function1s = function() { } | |
scuts.core.Function1s.__name__ = true; | |
scuts.core.Function1s.map = function(f,mapper) { | |
return function(a) { | |
return mapper(f(a)); | |
}; | |
} | |
scuts.core.Function1s.uncurry = function(f) { | |
return function(a) { | |
return (f(a))(); | |
}; | |
} | |
scuts.core.Function1s.compose = function(f1,f2) { | |
return function(a) { | |
return f1(f2(a)); | |
}; | |
} | |
scuts.core.Function1s.next = function(from,to) { | |
return scuts.core.Function1s.compose(to,from); | |
} | |
scuts.core.Function1s.toEffect = function(f) { | |
return function(x) { | |
f(x); | |
}; | |
} | |
scuts.core.Function1s._1 = function(f,a) { | |
return function() { | |
return f(a); | |
}; | |
} | |
scuts.core.Function2OptsPosInfos = function() { } | |
scuts.core.Function2OptsPosInfos.__name__ = true; | |
scuts.core.Function2OptsPosInfos.compose = function(f1,f2) { | |
return function(a) { | |
return f1(f2(a),{ fileName : "Functions.hx", lineNumber : 129, className : "scuts.core.Function2OptsPosInfos", methodName : "compose"}); | |
}; | |
} | |
scuts.core.Function2OptsPosInfos._0_ = function(f) { | |
return function(a) { | |
return f(a,{ fileName : "Functions.hx", lineNumber : 133, className : "scuts.core.Function2OptsPosInfos", methodName : "_0_"}); | |
}; | |
} | |
scuts.core.Function2Opts = function() { } | |
scuts.core.Function2Opts.__name__ = true; | |
scuts.core.Function2Opts.compose = function(f1,f2) { | |
return function(a) { | |
return f1(f2(a)); | |
}; | |
} | |
scuts.core.Function2Opts._0_ = function(f) { | |
return function(a) { | |
return f(a); | |
}; | |
} | |
scuts.core.Function2s = function() { } | |
scuts.core.Function2s.__name__ = true; | |
scuts.core.Function2s.map = function(f,mapper) { | |
return function(a,b) { | |
return mapper(f(a,b)); | |
}; | |
} | |
scuts.core.Function2s.curry = function(f) { | |
return function(a) { | |
return function(b) { | |
return f(a,b); | |
}; | |
}; | |
} | |
scuts.core.Function2s.uncurry = function(f) { | |
return function(a,b) { | |
return (f(a))(b); | |
}; | |
} | |
scuts.core.Function2s._1 = function(f,a) { | |
return function(b) { | |
return f(a,b); | |
}; | |
} | |
scuts.core.Function2s._2 = function(f,b) { | |
return function(a) { | |
return f(a,b); | |
}; | |
} | |
scuts.core.Function2s._12 = function(f,a,b) { | |
return function() { | |
return f(a,b); | |
}; | |
} | |
scuts.core.Function2s.flip = function(f) { | |
return function(b,a) { | |
return f(a,b); | |
}; | |
} | |
scuts.core.Function2s.tupled = function(f) { | |
return function(t) { | |
return f(t._1,t._2); | |
}; | |
} | |
scuts.core.Function2s.untupled = function(f) { | |
return function(a,b) { | |
return f(scuts.core.Tup2.create(a,b)); | |
}; | |
} | |
scuts.core.Function2s.toEffect = function(f) { | |
return function(a,b) { | |
f(a,b); | |
}; | |
} | |
scuts.core.Function3Opts2PosInfos = function() { } | |
scuts.core.Function3Opts2PosInfos.__name__ = true; | |
scuts.core.Function3Opts2PosInfos._0_ = function(f) { | |
return function(a) { | |
return f(a,null,{ fileName : "Functions.hx", lineNumber : 246, className : "scuts.core.Function3Opts2PosInfos", methodName : "_0_"}); | |
}; | |
} | |
scuts.core.Function3Opts2PosInfos._1_ = function(f,a) { | |
return function(b) { | |
return f(a,b,{ fileName : "Functions.hx", lineNumber : 251, className : "scuts.core.Function3Opts2PosInfos", methodName : "_1_"}); | |
}; | |
} | |
scuts.core.Function3Opts1PosInfos = function() { } | |
scuts.core.Function3Opts1PosInfos.__name__ = true; | |
scuts.core.Function3Opts1PosInfos._0_ = function(f) { | |
return function(a,b) { | |
return f(a,b,{ fileName : "Functions.hx", lineNumber : 264, className : "scuts.core.Function3Opts1PosInfos", methodName : "_0_"}); | |
}; | |
} | |
scuts.core.Function3Opts1PosInfos._1_ = function(f,a) { | |
return function(b) { | |
return f(a,b,{ fileName : "Functions.hx", lineNumber : 269, className : "scuts.core.Function3Opts1PosInfos", methodName : "_1_"}); | |
}; | |
} | |
scuts.core.Function3Opts1PosInfos._2_ = function(f,b) { | |
return function(a) { | |
return f(a,b,{ fileName : "Functions.hx", lineNumber : 274, className : "scuts.core.Function3Opts1PosInfos", methodName : "_2_"}); | |
}; | |
} | |
scuts.core.Function3Opts1PosInfos._12_ = function(f,a,b) { | |
return function() { | |
return f(a,b,{ fileName : "Functions.hx", lineNumber : 278, className : "scuts.core.Function3Opts1PosInfos", methodName : "_12_"}); | |
}; | |
} | |
scuts.core.Function3Opts3 = function() { } | |
scuts.core.Function3Opts3.__name__ = true; | |
scuts.core.Function3Opts3._0_ = function(f) { | |
return function() { | |
return f(); | |
}; | |
} | |
scuts.core.Function3Opts2 = function() { } | |
scuts.core.Function3Opts2.__name__ = true; | |
scuts.core.Function3Opts2._0_ = function(f) { | |
return function(a) { | |
return f(a); | |
}; | |
} | |
scuts.core.Function3Opts2._1_ = function(f,a) { | |
return function() { | |
return f(a); | |
}; | |
} | |
scuts.core.Function3Opts2.compose = function(f1,f2) { | |
return function(a) { | |
return f1(f2(a)); | |
}; | |
} | |
scuts.core.Function3Opts1 = function() { } | |
scuts.core.Function3Opts1.__name__ = true; | |
scuts.core.Function3Opts1._0_ = function(f) { | |
return function(a,b) { | |
return f(a,b); | |
}; | |
} | |
scuts.core.Function3Opts1._1_ = function(f,a) { | |
return function(b) { | |
return f(a,b); | |
}; | |
} | |
scuts.core.Function3Opts1._2_ = function(f,b) { | |
return function(a) { | |
return f(a,b); | |
}; | |
} | |
scuts.core.Function3Opts1._12_ = function(f,a,b) { | |
return function() { | |
return f(a,b); | |
}; | |
} | |
scuts.core.Function3s = function() { } | |
scuts.core.Function3s.__name__ = true; | |
scuts.core.Function3s.curry = function(f) { | |
return function(a) { | |
return function(b) { | |
return function(c) { | |
return f(a,b,c); | |
}; | |
}; | |
}; | |
} | |
scuts.core.Function3s.uncurry = function(f) { | |
return function(a,b,c) { | |
return ((f(a))(b))(c); | |
}; | |
} | |
scuts.core.Function3s.flip = function(f) { | |
return function(b,a,c) { | |
return f(a,b,c); | |
}; | |
} | |
scuts.core.Function3s.tupled = function(f) { | |
return function(t) { | |
return f(t._1,t._2,t._3); | |
}; | |
} | |
scuts.core.Function3s.untupled = function(f) { | |
return function(a,b,c) { | |
return f(scuts.core.Tup3.create(a,b,c)); | |
}; | |
} | |
scuts.core.Function3s.toEffect = function(f) { | |
return function(a,b,c) { | |
f(a,b,c); | |
}; | |
} | |
scuts.core.Function3s._1 = function(f,a) { | |
return function(b,c) { | |
return f(a,b,c); | |
}; | |
} | |
scuts.core.Function3s._13 = function(f,a,c) { | |
return function(b) { | |
return f(a,b,c); | |
}; | |
} | |
scuts.core.Function3s._12 = function(f,a,b) { | |
return function(c) { | |
return f(a,b,c); | |
}; | |
} | |
scuts.core.Function3s._23 = function(f,b,c) { | |
return function(a) { | |
return f(a,b,c); | |
}; | |
} | |
scuts.core.Function3s._2 = function(f,b) { | |
return function(a,c) { | |
return f(a,b,c); | |
}; | |
} | |
scuts.core.Function3s._3 = function(f,c) { | |
return function(a,b) { | |
return f(a,b,c); | |
}; | |
} | |
scuts.core.Function3s._123 = function(f,a,b,c) { | |
return function() { | |
return f(a,b,c); | |
}; | |
} | |
scuts.core.Function4Opt1s = function() { } | |
scuts.core.Function4Opt1s.__name__ = true; | |
scuts.core.Function4Opt1s._123_ = function(f,a,b,c) { | |
return function() { | |
return f(a,b,c); | |
}; | |
} | |
scuts.core.Function4s = function() { } | |
scuts.core.Function4s.__name__ = true; | |
scuts.core.Function4s.curry = function(f) { | |
return function(a) { | |
return function(b) { | |
return function(c) { | |
return function(d) { | |
return f(a,b,c,d); | |
}; | |
}; | |
}; | |
}; | |
} | |
scuts.core.Function4s.uncurry = function(f) { | |
return function(a,b,c,d) { | |
return (((f(a))(b))(c))(d); | |
}; | |
} | |
scuts.core.Function4s.flip = function(f) { | |
return function(b,a,c,d) { | |
return f(a,b,c,d); | |
}; | |
} | |
scuts.core.Function4s.toEffect = function(f) { | |
return function(a,b,c,d) { | |
f(a,b,c,d); | |
}; | |
} | |
scuts.core.Function4s._1 = function(f,a) { | |
return function(b,c,d) { | |
return f(a,b,c,d); | |
}; | |
} | |
scuts.core.Function4s._2 = function(f,b) { | |
return function(a,c,d) { | |
return f(a,b,c,d); | |
}; | |
} | |
scuts.core.Function4s._3 = function(f,c) { | |
return function(a,b,d) { | |
return f(a,b,c,d); | |
}; | |
} | |
scuts.core.Function4s._4 = function(f,d) { | |
return function(a,b,c) { | |
return f(a,b,c,d); | |
}; | |
} | |
scuts.core.Function4s._12 = function(f,a,b) { | |
return function(c,d) { | |
return f(a,b,c,d); | |
}; | |
} | |
scuts.core.Function4s._123 = function(f,a,b,c) { | |
return function(d) { | |
return f(a,b,c,d); | |
}; | |
} | |
scuts.core.Function4s._124 = function(f,a,b,d) { | |
return function(c) { | |
return f(a,b,c,d); | |
}; | |
} | |
scuts.core.Function4s._234 = function(f,b,c,d) { | |
return function(a) { | |
return f(a,b,c,d); | |
}; | |
} | |
scuts.core.Function4s._34 = function(f,c,d) { | |
return function(a,b) { | |
return f(a,b,c,d); | |
}; | |
} | |
scuts.core.Function4s._1234 = function(f,a,b,c,d) { | |
return function() { | |
return f(a,b,c,d); | |
}; | |
} | |
scuts.core.Function5Opt2s = function() { } | |
scuts.core.Function5Opt2s.__name__ = true; | |
scuts.core.Function5Opt2s._123_ = function(f,a,b,c) { | |
return function() { | |
return f(a,b,c); | |
}; | |
} | |
scuts.core.Function5Opt1s = function() { } | |
scuts.core.Function5Opt1s.__name__ = true; | |
scuts.core.Function5Opt1s._123_ = function(f,a,b,c) { | |
return function(d) { | |
return f(a,b,c,d); | |
}; | |
} | |
scuts.core.Function5s = function() { } | |
scuts.core.Function5s.__name__ = true; | |
scuts.core.Function5s.curry = function(f) { | |
return function(a) { | |
return function(b) { | |
return function(c) { | |
return function(d) { | |
return function(e) { | |
return f(a,b,c,d,e); | |
}; | |
}; | |
}; | |
}; | |
}; | |
} | |
scuts.core.Function5s.uncurry = function(f) { | |
return function(a,b,c,d,e) { | |
return ((((f(a))(b))(c))(d))(e); | |
}; | |
} | |
scuts.core.Function5s.flip = function(f) { | |
return function(b,a,c,d,e) { | |
return f(a,b,c,d,e); | |
}; | |
} | |
scuts.core.Function5s._1 = function(f,a) { | |
return function(b,c,d,e) { | |
return f(a,b,c,d,e); | |
}; | |
} | |
scuts.core.Function5s._2 = function(f,b) { | |
return function(a,c,d,e) { | |
return f(a,b,c,d,e); | |
}; | |
} | |
scuts.core.Function5s._3 = function(f,c) { | |
return function(a,b,d,e) { | |
return f(a,b,c,d,e); | |
}; | |
} | |
scuts.core.Function5s._4 = function(f,d) { | |
return function(a,b,c,e) { | |
return f(a,b,c,d,e); | |
}; | |
} | |
scuts.core.Function5s._5 = function(f,e) { | |
return function(a,b,c,d) { | |
return f(a,b,c,d,e); | |
}; | |
} | |
scuts.core.Function5s._1234 = function(f,a,b,c,d) { | |
return function(e) { | |
return f(a,b,c,d,e); | |
}; | |
} | |
scuts.core.Function5s._123 = function(f,a,b,c) { | |
return function(d,e) { | |
return f(a,b,c,d,e); | |
}; | |
} | |
scuts.core.Function5s._12 = function(f,a,b) { | |
return function(c,d,e) { | |
return f(a,b,c,d,e); | |
}; | |
} | |
scuts.core.Function5s._2345 = function(f,b,c,d,e) { | |
return function(a) { | |
return f(a,b,c,d,e); | |
}; | |
} | |
scuts.core.Function5s._12345 = function(f,a,b,c,d,e) { | |
return function() { | |
return f(a,b,c,d,e); | |
}; | |
} | |
scuts.core.Function6s = function() { } | |
scuts.core.Function6s.__name__ = true; | |
scuts.core.Function6s.curry = function(f) { | |
return function(a) { | |
return function(b) { | |
return function(c) { | |
return function(d) { | |
return function(e) { | |
return function(f1) { | |
return f(a,b,c,d,e,f1); | |
}; | |
}; | |
}; | |
}; | |
}; | |
}; | |
} | |
scuts.core.Function6s.uncurry = function(f) { | |
return function(a,b,c,d,e,f1) { | |
return (((((f(a))(b))(c))(d))(e))(f1); | |
}; | |
} | |
scuts.core.Ints = function() { } | |
scuts.core.Ints.__name__ = true; | |
scuts.core.Ints.eq = function(a,b) { | |
return a == b; | |
} | |
scuts.core.Ints.max = function(a,b) { | |
return a > b?a:b; | |
} | |
scuts.core.Ints.min = function(a,b) { | |
return a < b?a:b; | |
} | |
scuts.core.Ints.inRange = function(i,min,maxExcluded) { | |
return i >= min && i < maxExcluded; | |
} | |
scuts.core.Option = { __ename__ : true, __constructs__ : ["Some","None"] } | |
scuts.core.Option.Some = function(v) { var $x = ["Some",0,v]; $x.__enum__ = scuts.core.Option; $x.toString = $estr; return $x; } | |
scuts.core.Option.None = ["None",1]; | |
scuts.core.Option.None.toString = $estr; | |
scuts.core.Option.None.__enum__ = scuts.core.Option; | |
scuts.core.Options = function() { } | |
scuts.core.Options.__name__ = true; | |
scuts.core.Options.none = function() { | |
return scuts.core.Option.None; | |
} | |
scuts.core.Options.pure = function(a) { | |
return scuts.core.Option.Some(a); | |
} | |
scuts.core.Options.zipWith = function(a,b,f) { | |
return (function($this) { | |
var $r; | |
var $e = (a); | |
switch( $e[1] ) { | |
case 0: | |
var a_eSome_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (b); | |
switch( $e[1] ) { | |
case 0: | |
var b_eSome_0 = $e[2]; | |
$r = scuts.core.Option.Some(f(a_eSome_0,b_eSome_0)); | |
break; | |
case 1: | |
$r = scuts.core.Option.None; | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
case 1: | |
$r = scuts.core.Option.None; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.zip = function(a,b) { | |
return scuts.core.Options.zipWith(a,b,scuts.core.Tup2.create); | |
} | |
scuts.core.Options.compareBy = function(a,b,compareT) { | |
return (function($this) { | |
var $r; | |
var $e = (a); | |
switch( $e[1] ) { | |
case 1: | |
$r = (function($this) { | |
var $r; | |
switch( (b)[1] ) { | |
case 1: | |
$r = scuts.core.Ordering.EQ; | |
break; | |
case 0: | |
$r = scuts.core.Ordering.LT; | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
case 0: | |
var a_eSome_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (b); | |
switch( $e[1] ) { | |
case 1: | |
$r = scuts.core.Ordering.GT; | |
break; | |
case 0: | |
var b_eSome_0 = $e[2]; | |
$r = compareT(a_eSome_0,b_eSome_0); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.append = function(o1,o2,appendT) { | |
return (function($this) { | |
var $r; | |
var $e = (o1); | |
switch( $e[1] ) { | |
case 0: | |
var o1_eSome_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (o2); | |
switch( $e[1] ) { | |
case 0: | |
var o2_eSome_0 = $e[2]; | |
$r = scuts.core.Option.Some(appendT(o1_eSome_0,o2_eSome_0)); | |
break; | |
case 1: | |
$r = scuts.core.Option.None; | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
case 1: | |
$r = scuts.core.Option.None; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.getOrElseConst = function(o,elseValue) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = o_eSome_0; | |
break; | |
case 1: | |
$r = elseValue; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.orElse = function(o,elseValue) { | |
return (function($this) { | |
var $r; | |
switch( (o)[1] ) { | |
case 0: | |
$r = o; | |
break; | |
case 1: | |
$r = elseValue(); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.orNull = function(o) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = o_eSome_0; | |
break; | |
case 1: | |
$r = null; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.getOrElse = function(o,elseValue) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = o_eSome_0; | |
break; | |
case 1: | |
$r = elseValue(); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.getOrError = function(o,error,posInfos) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = o_eSome_0; | |
break; | |
case 1: | |
$r = scuts.Scuts.error(error,posInfos); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.toLeftConst = function(o,right) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = scuts.core.Either.Left(o_eSome_0); | |
break; | |
case 1: | |
$r = scuts.core.Either.Right(right); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.toLeft = function(o,right) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = scuts.core.Either.Left(o_eSome_0); | |
break; | |
case 1: | |
$r = scuts.core.Either.Right(right()); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.toRight = function(o,left) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = scuts.core.Either.Right(o_eSome_0); | |
break; | |
case 1: | |
$r = scuts.core.Either.Left(left()); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.toRightConst = function(o,left) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = scuts.core.Either.Right(o_eSome_0); | |
break; | |
case 1: | |
$r = scuts.core.Either.Left(left); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.eq = function(a,b,eqT) { | |
return (function($this) { | |
var $r; | |
var $e = (a); | |
switch( $e[1] ) { | |
case 1: | |
$r = (function($this) { | |
var $r; | |
switch( (b)[1] ) { | |
case 1: | |
$r = true; | |
break; | |
case 0: | |
$r = false; | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
case 0: | |
var a_eSome_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (b); | |
switch( $e[1] ) { | |
case 1: | |
$r = false; | |
break; | |
case 0: | |
var b_eSome_0 = $e[2]; | |
$r = eqT(a_eSome_0,b_eSome_0); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.isSome = function(o) { | |
return (function($this) { | |
var $r; | |
switch( (o)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.isNone = function(o) { | |
return !(function($this) { | |
var $r; | |
switch( (o)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.extract = function(o) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = o_eSome_0; | |
break; | |
case 1: | |
$r = scuts.Scuts.error("Cannot extract value from Option None",{ fileName : "Options.hx", lineNumber : 148, className : "scuts.core.Options", methodName : "extract"}); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.filter = function(o,filter) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = filter(o_eSome_0)?scuts.core.Option.Some(o_eSome_0):scuts.core.Option.None; | |
break; | |
case 1: | |
$r = scuts.core.Option.None; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.ifSome = function(o,ifVal,elseVal) { | |
return (function($this) { | |
var $r; | |
switch( (o)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this))?ifVal():elseVal(); | |
} | |
scuts.core.Options.ifNone = function(o,ifVal,elseVal) { | |
return !(function($this) { | |
var $r; | |
switch( (o)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this))?ifVal():elseVal(); | |
} | |
scuts.core.Options.flatten = function(o) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = o_eSome_0; | |
break; | |
case 1: | |
$r = scuts.core.Option.None; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.flatMap = function(o,f) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = f(o_eSome_0); | |
break; | |
case 1: | |
$r = scuts.core.Option.None; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.map = function(o,f) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = scuts.core.Option.Some(f(o_eSome_0)); | |
break; | |
case 1: | |
$r = scuts.core.Option.None; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Options.each = function(o,f) { | |
var $e = (o); | |
switch( $e[1] ) { | |
case 1: | |
break; | |
case 0: | |
var o_eSome_0 = $e[2]; | |
f(o_eSome_0); | |
break; | |
} | |
} | |
scuts.core.Options.toString = function(o,aToString) { | |
var toStr = aToString == null?Std.string:aToString; | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = "Some(" + toStr(o_eSome_0) + ")"; | |
break; | |
case 1: | |
$r = "None"; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.OptionDynamicConversions = function() { } | |
scuts.core.OptionDynamicConversions.__name__ = true; | |
scuts.core.OptionDynamicConversions.toOption = function(v) { | |
return scuts.core.Option.Some(v); | |
} | |
scuts.core.OptionDynamicConversions.nullToOption = function(v) { | |
return v != null?scuts.core.Option.Some(v):scuts.core.Option.None; | |
} | |
scuts.core.Ordering = { __ename__ : true, __constructs__ : ["LT","EQ","GT"] } | |
scuts.core.Ordering.LT = ["LT",0]; | |
scuts.core.Ordering.LT.toString = $estr; | |
scuts.core.Ordering.LT.__enum__ = scuts.core.Ordering; | |
scuts.core.Ordering.EQ = ["EQ",1]; | |
scuts.core.Ordering.EQ.toString = $estr; | |
scuts.core.Ordering.EQ.__enum__ = scuts.core.Ordering; | |
scuts.core.Ordering.GT = ["GT",2]; | |
scuts.core.Ordering.GT.toString = $estr; | |
scuts.core.Ordering.GT.__enum__ = scuts.core.Ordering; | |
scuts.core.PosInfosTools = function() { } | |
scuts.core.PosInfosTools.__name__ = true; | |
scuts.core.PosInfosTools.toString = function(p) { | |
return p.fileName + "(line " + p.lineNumber + ") - " + p.className + "." + p.methodName; | |
} | |
scuts.core.Predicates = function() { } | |
scuts.core.Predicates.__name__ = true; | |
scuts.core.Predicates.constTrue0 = function() { | |
return true; | |
} | |
scuts.core.Predicates.constFalse0 = function() { | |
return false; | |
} | |
scuts.core.Predicates.constTrue1 = function(t) { | |
return true; | |
} | |
scuts.core.Predicates.constFalse1 = function(t) { | |
return false; | |
} | |
scuts.core.Predicates.constTrue2 = function(a,b) { | |
return true; | |
} | |
scuts.core.Predicates.constFalse2 = function(a,b) { | |
return false; | |
} | |
scuts.core.Predicates0 = function() { } | |
scuts.core.Predicates0.__name__ = true; | |
scuts.core.Predicates0.and = function(p1,p2) { | |
return function() { | |
return p1() && p2(); | |
}; | |
} | |
scuts.core.Predicates0.not = function(p) { | |
return function() { | |
return !p(); | |
}; | |
} | |
scuts.core.Predicates0.or = function(p1,p2) { | |
return function() { | |
return p1() || p2(); | |
}; | |
} | |
scuts.core.Predicates0.ifElse = function(p,ifVal,elseVal) { | |
return function() { | |
return p()?ifVal():elseVal(); | |
}; | |
} | |
scuts.core.Predicates1 = function() { } | |
scuts.core.Predicates1.__name__ = true; | |
scuts.core.Predicates1.and = function(p1,p2) { | |
return function(a) { | |
return p1(a) && p2(a); | |
}; | |
} | |
scuts.core.Predicates1.not = function(p) { | |
return function(a) { | |
return !p(a); | |
}; | |
} | |
scuts.core.Predicates1.or = function(p1,p2) { | |
return function(a) { | |
return p1(a) || p2(a); | |
}; | |
} | |
scuts.core.Predicates1.ifElse = function(p,ifVal,elseVal) { | |
return function(a) { | |
return p(a)?ifVal():elseVal(); | |
}; | |
} | |
scuts.core.Predicates2 = function() { } | |
scuts.core.Predicates2.__name__ = true; | |
scuts.core.Predicates2.and = function(p1,p2) { | |
return function(a,b) { | |
return p1(a,b) && p2(a,b); | |
}; | |
} | |
scuts.core.Predicates2.not = function(p) { | |
return function(a,b) { | |
return !p(a,b); | |
}; | |
} | |
scuts.core.Predicates2.or = function(p1,p2) { | |
return function(a,b) { | |
return p1(a,b) || p2(a,b); | |
}; | |
} | |
scuts.core.Predicates2.ifElse = function(p,ifVal,elseVal) { | |
return function(a,b) { | |
return p(a,b)?ifVal():elseVal(); | |
}; | |
} | |
scuts.core.Promise = function() { | |
this._complete = false; | |
this._cancelled = false; | |
this._value = scuts.core.Option.None; | |
this.clearListeners(); | |
}; | |
scuts.core.Promise.__name__ = true; | |
scuts.core.Promise.prototype = { | |
onCancelled: function(f) { | |
if(!this._complete) { | |
if(this._cancelled) f(); else { | |
this._cancelListeners.push(f); | |
null; | |
} | |
} | |
return this; | |
} | |
,onComplete: function(f) { | |
if(this._complete) f(this.extract()); else if(!this._cancelled) { | |
this._completeListeners.push(f); | |
null; | |
} | |
return this; | |
} | |
,cancel: function() { | |
return !this._complete && !this._cancelled?(function($this) { | |
var $r; | |
{ | |
$this._cancelled = true; | |
var _g = 0, _g1 = $this._cancelListeners; | |
while(_g < _g1.length) { | |
var c = _g1[_g]; | |
++_g; | |
c(); | |
} | |
$this.clearListeners(); | |
} | |
$r = $this._cancelled; | |
return $r; | |
}(this)):false; | |
} | |
,clearListeners: function() { | |
this._completeListeners = []; | |
this._cancelListeners = []; | |
this._progressListeners = []; | |
} | |
,complete: function(val) { | |
return this._complete || this._cancelled?this:(function($this) { | |
var $r; | |
{ | |
$this._value = scuts.core.Option.Some(val); | |
$this._complete = true; | |
$this.progress(1.0); | |
var _g = 0, _g1 = $this._completeListeners; | |
while(_g < _g1.length) { | |
var c = _g1[_g]; | |
++_g; | |
c(val); | |
} | |
$this.clearListeners(); | |
} | |
$r = $this; | |
return $r; | |
}(this)); | |
} | |
,progress: function(percent) { | |
var _g = 0, _g1 = this._progressListeners; | |
while(_g < _g1.length) { | |
var l = _g1[_g]; | |
++_g; | |
l(percent); | |
} | |
return this; | |
} | |
,onProgress: function(f) { | |
if(this._complete) f(1.0); else if(!this._cancelled) { | |
this._progressListeners.push(f); | |
null; | |
} | |
return this; | |
} | |
,extract: function() { | |
return scuts.core.Options.getOrError(this._value,"error result is not available",{ fileName : "Promise.hx", lineNumber : 100, className : "scuts.core.Promise", methodName : "extract"}); | |
} | |
,valueOption: function() { | |
return this._value; | |
} | |
,isDone: function() { | |
return this._complete || this._cancelled; | |
} | |
,isCancelled: function() { | |
return this._cancelled; | |
} | |
,isComplete: function() { | |
return this._complete; | |
} | |
,isCancelledDoubleCheck: function() { | |
return false; | |
} | |
,isDoneDoubleCheck: function() { | |
return false; | |
} | |
,isCompleteDoubleCheck: function() { | |
return false; | |
} | |
,initMutex: function() { | |
} | |
,unlock: function() { | |
} | |
,lock: function() { | |
} | |
} | |
scuts.core.Promises = function() { } | |
scuts.core.Promises.__name__ = true; | |
scuts.core.Promises.combineIterableWith = function(a,f) { | |
var fut = new scuts.core.Promise(); | |
var res = []; | |
var progs = []; | |
var len = -1; | |
var count = 0; | |
var isDelivered = false; | |
var check = function() { | |
if(len > -1 && count == len) { | |
if(isDelivered) scuts.Scuts.error("Cannot deliver twice",{ fileName : "Promises.hx", lineNumber : 38, className : "scuts.core.Promises", methodName : "combineIterableWith"}); | |
isDelivered = true; | |
fut.complete(f(res)); | |
} | |
}; | |
var updateProgress = function() { | |
if(len > 0) { | |
var r = 0.0; | |
var _g = 0; | |
while(_g < progs.length) { | |
var p = progs[_g]; | |
++_g; | |
r += p; | |
} | |
fut.progress(r / len); | |
} | |
}; | |
var x = 0; | |
var cancel = function() { | |
fut.cancel(); | |
return null; | |
}; | |
var $it0 = $iterator(a)(); | |
while( $it0.hasNext() ) { | |
var f1 = $it0.next(); | |
var index = [x]; | |
progs[index[0]] = 0.0; | |
f1.onComplete((function(index) { | |
return function(v) { | |
if(res[index[0]] != null) throw "ERROR"; | |
res[index[0]] = v; | |
count++; | |
check(); | |
return null; | |
}; | |
})(index)); | |
f1.onCancelled(cancel); | |
f1.onProgress((function(index) { | |
return function(p) { | |
progs[index[0]] = p; | |
updateProgress(); | |
return null; | |
}; | |
})(index)); | |
x++; | |
} | |
len = x; | |
updateProgress(); | |
check(); | |
return fut; | |
} | |
scuts.core.Promises.combineIterable = function(a) { | |
return scuts.core.Promises.combineIterableWith(a,scuts.Scuts.id); | |
} | |
scuts.core.Promises.apply = function(f,p) { | |
return scuts.core.Promises.zipWith(f,p,function(g,x) { | |
return g(x); | |
}); | |
} | |
scuts.core.Promises.cancelled = function() { | |
var p = new scuts.core.Promise(); | |
p.cancel(); | |
return p; | |
} | |
scuts.core.Promises.pure = function(s) { | |
return new scuts.core.Promise().complete(s); | |
} | |
scuts.core.Promises.mk = function() { | |
return new scuts.core.Promise(); | |
} | |
scuts.core.Promises.flatMap = function(p,f) { | |
var res = new scuts.core.Promise(); | |
var complete = function(r) { | |
var p1 = f(r); | |
p1.onComplete($bind(res,res.complete)); | |
p1.onProgress(function(p2) { | |
res.progress(0.5 + p2 * 0.5); | |
return null; | |
}); | |
p1.onCancelled($bind(res,res.cancel)); | |
return null; | |
}; | |
p.onComplete(complete).onCancelled($bind(res,res.cancel)).onProgress(function(p1) { | |
res.progress(p1 * 0.5); | |
return null; | |
}); | |
return res; | |
} | |
scuts.core.Promises.map = function(p,f) { | |
var res = new scuts.core.Promise(); | |
p.onComplete(scuts.core.Function1s.compose($bind(res,res.complete),f)).onCancelled($bind(res,res.cancel)).onProgress($bind(res,res.progress)); | |
return res; | |
} | |
scuts.core.Promises.filter = function(p,f) { | |
var res = new scuts.core.Promise(); | |
p.onComplete(function(x) { | |
if(f(x)) res.complete(x); else res.cancel(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress($bind(res,res.progress)); | |
return res; | |
} | |
scuts.core.Promises.flatten = function(p) { | |
var res = new scuts.core.Promise(); | |
var complete = function(x) { | |
x.onComplete($bind(res,res.complete)).onCancelled($bind(res,res.cancel)).onProgress($bind(res,res.progress)); | |
return null; | |
}; | |
p.onComplete(complete).onCancelled($bind(res,res.cancel)).onProgress($bind(res,res.progress)); | |
return res; | |
} | |
scuts.core.Promises.then = function(a,b) { | |
return scuts.core.Promises.flatMap(a,function(_) { | |
return b(); | |
}); | |
} | |
scuts.core.Promises.zip = function(a,b) { | |
return (scuts.core.Promises.liftPromiseF2(scuts.core.Tup2.create))(a,b); | |
} | |
scuts.core.Promises.zip3 = function(a,b,c) { | |
return (scuts.core.Promises.liftPromiseF3(scuts.core.Tup3.create))(a,b,c); | |
} | |
scuts.core.Promises.zip4 = function(a,b,c,d) { | |
return (scuts.core.Promises.liftPromiseF4(scuts.core.Tup4.create))(a,b,c,d); | |
} | |
scuts.core.Promises.zipWith = function(a,b,f) { | |
return (scuts.core.Promises.liftPromiseF2(f))(a,b); | |
} | |
scuts.core.Promises.zipWith3 = function(a,b,c,f) { | |
return (scuts.core.Promises.liftPromiseF3(f))(a,b,c); | |
} | |
scuts.core.Promises.zipWith4 = function(a,b,c,d,f) { | |
return (scuts.core.Promises.liftPromiseF4(f))(a,b,c,d); | |
} | |
scuts.core.Promises.liftPromiseF0 = function(f) { | |
return function() { | |
return new scuts.core.Promise().complete(f()); | |
}; | |
} | |
scuts.core.Promises.liftPromiseF1 = function(f) { | |
return function(a) { | |
var res = new scuts.core.Promise(); | |
a.onComplete(scuts.core.Function1s.compose($bind(res,res.complete),f)).onCancelled($bind(res,res.cancel)).onProgress($bind(res,res.progress)); | |
return res; | |
}; | |
} | |
scuts.core.Promises.liftPromiseF2 = function(f) { | |
return function(a,b) { | |
var res = new scuts.core.Promise(); | |
var valA = scuts.core.Option.None; | |
var valB = scuts.core.Option.None; | |
var check = function() { | |
if((function($this) { | |
var $r; | |
switch( (valA)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this)) && (function($this) { | |
var $r; | |
switch( (valB)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this))) res.complete(f(scuts.core.Options.extract(valA),scuts.core.Options.extract(valB))); | |
}; | |
var progress = function(p) { | |
res.progress(p * 0.5); | |
return null; | |
}; | |
a.onComplete(function(r) { | |
valA = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
b.onComplete(function(r) { | |
valB = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
return res; | |
}; | |
} | |
scuts.core.Promises.liftPromiseF3 = function(f) { | |
return function(a,b,c) { | |
var res = new scuts.core.Promise(); | |
var valA = scuts.core.Option.None; | |
var valB = scuts.core.Option.None; | |
var valC = scuts.core.Option.None; | |
var check = function() { | |
if((function($this) { | |
var $r; | |
switch( (valA)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this)) && (function($this) { | |
var $r; | |
switch( (valB)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this)) && (function($this) { | |
var $r; | |
switch( (valC)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this))) res.complete(f(scuts.core.Options.extract(valA),scuts.core.Options.extract(valB),scuts.core.Options.extract(valC))); | |
}; | |
var progress = function(p) { | |
res.progress(p * (1 / 3)); | |
return null; | |
}; | |
a.onComplete(function(r) { | |
valA = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
b.onComplete(function(r) { | |
valB = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
c.onComplete(function(r) { | |
valC = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
return res; | |
}; | |
} | |
scuts.core.Promises.liftPromiseF4 = function(f) { | |
return function(a,b,c,d) { | |
var res = new scuts.core.Promise(); | |
var valA = scuts.core.Option.None; | |
var valB = scuts.core.Option.None; | |
var valC = scuts.core.Option.None; | |
var valD = scuts.core.Option.None; | |
var check = function() { | |
if((function($this) { | |
var $r; | |
switch( (valA)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this)) && (function($this) { | |
var $r; | |
switch( (valB)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this)) && (function($this) { | |
var $r; | |
switch( (valC)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this)) && (function($this) { | |
var $r; | |
switch( (valD)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this))) res.complete(f(scuts.core.Options.extract(valA),scuts.core.Options.extract(valB),scuts.core.Options.extract(valC),scuts.core.Options.extract(valD))); | |
}; | |
var progress = function(p) { | |
res.progress(p * 0.25); | |
return null; | |
}; | |
a.onComplete(function(r) { | |
valA = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
b.onComplete(function(r) { | |
valB = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
c.onComplete(function(r) { | |
valC = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
d.onComplete(function(r) { | |
valD = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
return res; | |
}; | |
} | |
scuts.core.Promises.liftPromiseF5 = function(f) { | |
return function(a,b,c,d,e) { | |
var res = new scuts.core.Promise(); | |
var valA = scuts.core.Option.None; | |
var valB = scuts.core.Option.None; | |
var valC = scuts.core.Option.None; | |
var valD = scuts.core.Option.None; | |
var valE = scuts.core.Option.None; | |
var check = function() { | |
if((function($this) { | |
var $r; | |
switch( (valA)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this)) && (function($this) { | |
var $r; | |
switch( (valB)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this)) && (function($this) { | |
var $r; | |
switch( (valC)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this)) && (function($this) { | |
var $r; | |
switch( (valD)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this)) && (function($this) { | |
var $r; | |
switch( (valE)[1] ) { | |
case 0: | |
$r = true; | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}(this))) res.complete(f(scuts.core.Options.extract(valA),scuts.core.Options.extract(valB),scuts.core.Options.extract(valC),scuts.core.Options.extract(valD),scuts.core.Options.extract(valE))); | |
}; | |
var progress = function(p) { | |
res.progress(p * 0.2); | |
return null; | |
}; | |
a.onComplete(function(r) { | |
valA = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
b.onComplete(function(r) { | |
valB = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
c.onComplete(function(r) { | |
valC = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
d.onComplete(function(r) { | |
valD = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
e.onComplete(function(r) { | |
valE = scuts.core.Option.Some(r); | |
check(); | |
return null; | |
}).onCancelled($bind(res,res.cancel)).onProgress(progress); | |
return res; | |
}; | |
} | |
scuts.core.States = function() { } | |
scuts.core.States.__name__ = true; | |
scuts.core.States.map = function(x,f) { | |
return function(s) { | |
var t = x(s); | |
return scuts.core.Tup2.create(t._1,f(t._2)); | |
}; | |
} | |
scuts.core.States.pure = function(x) { | |
return function(s) { | |
return scuts.core.Tup2.create(s,x); | |
}; | |
} | |
scuts.core.States.flatMap = function(x,f) { | |
return function(s) { | |
var z = x(s); | |
return (f(z._2))(z._1); | |
}; | |
} | |
scuts.core.Strings = function() { } | |
scuts.core.Strings.__name__ = true; | |
scuts.core.Strings.times = function(s,t) { | |
var b = new StringBuf(); | |
while(t-- > 0) b.b += Std.string(s); | |
return b.b; | |
} | |
scuts.core.Strings.trim = function(s) { | |
return StringTools.trim(s); | |
} | |
scuts.core.Strings.trimLeft = function(s) { | |
return StringTools.ltrim(s); | |
} | |
scuts.core.Strings.trimRight = function(s) { | |
return StringTools.rtrim(s); | |
} | |
scuts.core.Strings.padLeft = function(s,c,length) { | |
return StringTools.lpad(s,c,length); | |
} | |
scuts.core.Strings.padRight = function(s,c,length) { | |
return StringTools.rpad(s,c,length); | |
} | |
scuts.core.Strings.indent = function(s,indent) { | |
return indent + s.split("\n").join("\n" + indent); | |
} | |
scuts.core.Strings.unindent = function(s,indent) { | |
if(StringTools.startsWith(s,indent)) s = HxOverrides.substr(s,indent.length,null); | |
return s.split("\n" + indent).join("\n"); | |
} | |
scuts.core.Strings.toInt = function(s) { | |
var i = Std.parseInt(s); | |
return i != null?scuts.core.Option.Some(i):scuts.core.Option.None; | |
} | |
scuts.core.Strings.toFloat = function(s) { | |
var i = Std.parseFloat(s); | |
return i != null?scuts.core.Option.Some(i):scuts.core.Option.None; | |
} | |
scuts.core.Strings.startsWith = function(s,start) { | |
return StringTools.startsWith(s,start); | |
} | |
scuts.core.Strings.endsWith = function(s,end) { | |
return StringTools.endsWith(s,end); | |
} | |
scuts.core.Strings.replace = function(s,sub,by) { | |
return StringTools.replace(s,sub,by); | |
} | |
scuts.core.Strings.replaceEReg = function(s,pattern,by) { | |
return pattern.replace(s,by); | |
} | |
scuts.core.Strings.countSub = function(s,sub) { | |
var i = 0; | |
var count = 0; | |
while(true) { | |
var i1 = s.indexOf(sub,i); | |
if(i1 != -1) count++; else break; | |
} | |
return count; | |
} | |
scuts.core.Strings.eq = function(s1,s2) { | |
return s1 == s2; | |
} | |
scuts.core.Strings.lines = function(s) { | |
return s.split("\r").join("").split("\n"); | |
} | |
scuts.core.Strings.unlines = function(lines) { | |
return lines.join("\n"); | |
} | |
scuts.core.Strings.words = function(s) { | |
return new EReg("([\r][\n])|[ \n\t]","").split(s); | |
} | |
scuts.core.Strings.unwords = function(s) { | |
return s.join(" "); | |
} | |
scuts.core.Tup2 = function(_1,_2) { | |
this._1 = _1; | |
this._2 = _2; | |
}; | |
scuts.core.Tup2.__name__ = true; | |
scuts.core.Tup2.create = function(_1,_2) { | |
return new scuts.core.Tup2(_1,_2); | |
} | |
scuts.core.Tup2.prototype = { | |
toString: function() { | |
var s = Std.string; | |
return "(" + s(this._1) + "," + s(this._2) + ")"; | |
} | |
} | |
scuts.core.Tup2s = function() { } | |
scuts.core.Tup2s.__name__ = true; | |
scuts.core.Tup2s.swap = function(t) { | |
return scuts.core.Tup2.create(t._2,t._1); | |
} | |
scuts.core.Tup2s.first = function(t) { | |
return t._1; | |
} | |
scuts.core.Tup2s.second = function(t) { | |
return t._2; | |
} | |
scuts.core.Tup2s.eq = function(t1,t2,eq1,eq2) { | |
return eq1(t1._1,t2._1) && eq2(t1._2,t2._2); | |
} | |
scuts.core.Tup3 = function(_1,_2,_3) { | |
this._1 = _1; | |
this._2 = _2; | |
this._3 = _3; | |
}; | |
scuts.core.Tup3.__name__ = true; | |
scuts.core.Tup3.create = function(_1,_2,_3) { | |
return new scuts.core.Tup3(_1,_2,_3); | |
} | |
scuts.core.Tup3.prototype = { | |
toString: function() { | |
var s = Std.string; | |
return "(" + s(this._1) + "," + s(this._2) + "," + s(this._3) + ")"; | |
} | |
} | |
scuts.core.Tup4 = function(_1,_2,_3,_4) { | |
this._1 = _1; | |
this._2 = _2; | |
this._3 = _3; | |
this._4 = _4; | |
}; | |
scuts.core.Tup4.__name__ = true; | |
scuts.core.Tup4.create = function(_1,_2,_3,_4) { | |
return new scuts.core.Tup4(_1,_2,_3,_4); | |
} | |
scuts.core.Tup4.prototype = { | |
toString: function() { | |
var s = Std.string; | |
return "(" + s(this._1) + "," + s(this._2) + "," + s(this._3) + "," + s(this._4) + ")"; | |
} | |
} | |
scuts.core.Unit = { __ename__ : true, __constructs__ : ["Unit"] } | |
scuts.core.Unit.Unit = ["Unit",0]; | |
scuts.core.Unit.Unit.toString = $estr; | |
scuts.core.Unit.Unit.__enum__ = scuts.core.Unit; | |
scuts.core.Validation = { __ename__ : true, __constructs__ : ["Failure","Success"] } | |
scuts.core.Validation.Failure = function(f) { var $x = ["Failure",0,f]; $x.__enum__ = scuts.core.Validation; $x.toString = $estr; return $x; } | |
scuts.core.Validation.Success = function(s) { var $x = ["Success",1,s]; $x.__enum__ = scuts.core.Validation; $x.toString = $estr; return $x; } | |
scuts.core.Validations = function() { } | |
scuts.core.Validations.__name__ = true; | |
scuts.core.Validations.eq = function(v1,v2,eqFailure,eqSuccess) { | |
return (function($this) { | |
var $r; | |
var $e = (v1); | |
switch( $e[1] ) { | |
case 0: | |
var v1_eFailure_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (v2); | |
switch( $e[1] ) { | |
case 0: | |
var v2_eFailure_0 = $e[2]; | |
$r = eqFailure(v1_eFailure_0,v2_eFailure_0); | |
break; | |
case 1: | |
$r = false; | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
case 1: | |
var v1_eSuccess_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (v2); | |
switch( $e[1] ) { | |
case 0: | |
$r = false; | |
break; | |
case 1: | |
var v2_eSuccess_0 = $e[2]; | |
$r = eqSuccess(v1_eSuccess_0,v2_eSuccess_0); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.either = function(v) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
$r = scuts.core.Either.Left(v_eFailure_0); | |
break; | |
case 1: | |
var v_eSuccess_0 = $e[2]; | |
$r = scuts.core.Either.Right(v_eSuccess_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.bool = function(v) { | |
return (function($this) { | |
var $r; | |
switch( (v)[1] ) { | |
case 0: | |
$r = false; | |
break; | |
case 1: | |
$r = true; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.apply = function(v,f,appendFailure) { | |
return (function($this) { | |
var $r; | |
var $e = (f); | |
switch( $e[1] ) { | |
case 1: | |
var f_eSuccess_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 1: | |
var v_eSuccess_0 = $e[2]; | |
$r = scuts.core.Validation.Success(f_eSuccess_0(v_eSuccess_0)); | |
break; | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(v_eFailure_0); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
case 0: | |
var f_eFailure_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 1: | |
$r = scuts.core.Validation.Failure(f_eFailure_0); | |
break; | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(appendFailure(f_eFailure_0,v_eFailure_0)); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.append = function(a1,a2,appendFailure,appendSuccess) { | |
return (function($this) { | |
var $r; | |
var $e = (a1); | |
switch( $e[1] ) { | |
case 1: | |
var a1_eSuccess_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (a2); | |
switch( $e[1] ) { | |
case 1: | |
var a2_eSuccess_0 = $e[2]; | |
$r = scuts.core.Validation.Success(appendSuccess(a1_eSuccess_0,a2_eSuccess_0)); | |
break; | |
case 0: | |
var a2_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(a2_eFailure_0); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
case 0: | |
var a1_eFailure_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (a2); | |
switch( $e[1] ) { | |
case 1: | |
$r = scuts.core.Validation.Failure(a1_eFailure_0); | |
break; | |
case 0: | |
var a2_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(appendFailure(a1_eFailure_0,a2_eFailure_0)); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.getOrElse = function(v,withFailure) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
$r = withFailure(v_eFailure_0); | |
break; | |
case 1: | |
var v_eSuccess_0 = $e[2]; | |
$r = v_eSuccess_0; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.ifFailure = function(v,f) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
$r = f(); | |
break; | |
case 1: | |
var v_eSuccess_0 = $e[2]; | |
$r = scuts.core.Validation.Success(v_eSuccess_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.ifSuccess = function(v,f) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(v_eFailure_0); | |
break; | |
case 1: | |
$r = f(); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.extract = function(v) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
$r = scuts.Scuts.error("Validation has no Success value",{ fileName : "Validations.hx", lineNumber : 99, className : "scuts.core.Validations", methodName : "extract"}); | |
break; | |
case 1: | |
var v_eSuccess_0 = $e[2]; | |
$r = v_eSuccess_0; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.extractFailure = function(v) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
$r = v_eFailure_0; | |
break; | |
case 1: | |
$r = scuts.Scuts.error("Validation has no Failure value",{ fileName : "Validations.hx", lineNumber : 109, className : "scuts.core.Validations", methodName : "extractFailure"}); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.option = function(v) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
$r = scuts.core.Option.None; | |
break; | |
case 1: | |
var v_eSuccess_0 = $e[2]; | |
$r = scuts.core.Option.Some(v_eSuccess_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.optionFailure = function(v) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
$r = scuts.core.Option.Some(v_eFailure_0); | |
break; | |
case 1: | |
$r = scuts.core.Option.None; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.each = function(v,f) { | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
break; | |
case 1: | |
var v_eSuccess_0 = $e[2]; | |
f(v_eSuccess_0); | |
break; | |
} | |
} | |
scuts.core.Validations.eachFailure = function(v,f) { | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
f(v_eFailure_0); | |
break; | |
case 1: | |
break; | |
} | |
} | |
scuts.core.Validations.isSuccess = function(v) { | |
return (function($this) { | |
var $r; | |
switch( (v)[1] ) { | |
case 0: | |
$r = false; | |
break; | |
case 1: | |
$r = true; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.isFailure = function(e) { | |
return !scuts.core.Validations.isSuccess(e); | |
} | |
scuts.core.Validations.flatMap = function(o,f) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(o_eFailure_0); | |
break; | |
case 1: | |
var o_eSuccess_0 = $e[2]; | |
$r = f(o_eSuccess_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.flatMapFailure = function(o,f) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eFailure_0 = $e[2]; | |
$r = f(o_eFailure_0); | |
break; | |
case 1: | |
var o_eSuccess_0 = $e[2]; | |
$r = scuts.core.Validation.Success(o_eSuccess_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.flatten = function(v) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(v_eFailure_0); | |
break; | |
case 1: | |
var v_eSuccess_0 = $e[2]; | |
$r = v_eSuccess_0; | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.flattenFailure = function(v) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
$r = v_eFailure_0; | |
break; | |
case 1: | |
var v_eSuccess_0 = $e[2]; | |
$r = scuts.core.Validation.Success(v_eSuccess_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.map = function(v,f) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(v_eFailure_0); | |
break; | |
case 1: | |
var v_eSuccess_0 = $e[2]; | |
$r = scuts.core.Validation.Success(f(v_eSuccess_0)); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.mapFailure = function(v,f) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(f(v_eFailure_0)); | |
break; | |
case 1: | |
var v_eSuccess_0 = $e[2]; | |
$r = scuts.core.Validation.Success(v_eSuccess_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.fail = function(v) { | |
return v; | |
} | |
scuts.core.Validations.zipVal2 = function(s1,v2) { | |
return (function($this) { | |
var $r; | |
var $e = (v2); | |
switch( $e[1] ) { | |
case 1: | |
var v2_eSuccess_0 = $e[2]; | |
$r = scuts.core.Validation.Success(scuts.core.Tup2.create(s1,v2_eSuccess_0)); | |
break; | |
case 0: | |
var v2_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(v2_eFailure_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.zipVal3 = function(s1,s2,v) { | |
return (function($this) { | |
var $r; | |
var $e = (v); | |
switch( $e[1] ) { | |
case 1: | |
var v_eSuccess_0 = $e[2]; | |
$r = scuts.core.Validation.Success(scuts.core.Tup3.create(s1,s2,v_eSuccess_0)); | |
break; | |
case 0: | |
var v_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(v_eFailure_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.zipWith = function(v1,v2,f) { | |
return (function($this) { | |
var $r; | |
var $e = (v1); | |
switch( $e[1] ) { | |
case 1: | |
var v1_eSuccess_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var $e = (v2); | |
switch( $e[1] ) { | |
case 1: | |
var v2_eSuccess_0 = $e[2]; | |
$r = scuts.core.Validation.Success(f(v1_eSuccess_0,v2_eSuccess_0)); | |
break; | |
case 0: | |
var v2_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(v2_eFailure_0); | |
break; | |
} | |
return $r; | |
}($this)); | |
break; | |
case 0: | |
var v1_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(v1_eFailure_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.zip = function(v1,v2) { | |
return (function($this) { | |
var $r; | |
var $e = (v1); | |
switch( $e[1] ) { | |
case 1: | |
var v1_eSuccess_0 = $e[2]; | |
$r = scuts.core.Validations.zipVal2(v1_eSuccess_0,v2); | |
break; | |
case 0: | |
var v1_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(v1_eFailure_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.zipLazy = function(v1,v2) { | |
return (function($this) { | |
var $r; | |
var $e = (v1); | |
switch( $e[1] ) { | |
case 1: | |
var v1_eSuccess_0 = $e[2]; | |
$r = scuts.core.Validations.zipVal2(v1_eSuccess_0,v2()); | |
break; | |
case 0: | |
var v1_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(v1_eFailure_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.zipLazy3 = function(v1,v2,v3) { | |
return (function($this) { | |
var $r; | |
var $e = (v1); | |
switch( $e[1] ) { | |
case 1: | |
var v1_eSuccess_0 = $e[2]; | |
$r = (function($this) { | |
var $r; | |
var _g = v2(); | |
$r = (function($this) { | |
var $r; | |
var $e = (_g); | |
switch( $e[1] ) { | |
case 1: | |
var _g_eSuccess_0 = $e[2]; | |
$r = scuts.core.Validations.zipVal3(v1_eSuccess_0,_g_eSuccess_0,v3()); | |
break; | |
case 0: | |
var _g_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(_g_eFailure_0); | |
break; | |
} | |
return $r; | |
}($this)); | |
return $r; | |
}($this)); | |
break; | |
case 0: | |
var v1_eFailure_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(v1_eFailure_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.Validations.zip2 = function(v1,v2,v3) { | |
return scuts.core.Validations.zipLazy3(v1,scuts.core.Dynamics.thunk(v2),scuts.core.Dynamics.thunk(v3)); | |
} | |
scuts.core.FailProjectionExt = function() { } | |
scuts.core.FailProjectionExt.__name__ = true; | |
scuts.core.FailProjectionExt.success = function(v) { | |
return v; | |
} | |
scuts.core.FailProjectionExt.map = function(v,f) { | |
return scuts.core.Validations.mapFailure(v,f); | |
} | |
scuts.core.FailProjectionExt.flatMap = function(v,f) { | |
return scuts.core.Validations.flatMapFailure(v,f); | |
} | |
scuts.core.FailProjectionExt.flatten = function(v) { | |
return scuts.core.Validations.flattenFailure(v); | |
} | |
scuts.core.FailProjectionExt.isSuccess = function(v) { | |
return scuts.core.Validations.isSuccess(v); | |
} | |
scuts.core.FailProjectionExt.isFailure = function(v) { | |
return !scuts.core.Validations.isSuccess(v); | |
} | |
scuts.core.FailProjectionExt.option = function(v) { | |
return scuts.core.Validations.optionFailure(v); | |
} | |
scuts.core.FailProjectionExt.each = function(v,f) { | |
return scuts.core.Validations.eachFailure(v,f); | |
} | |
scuts.core.FailProjectionExt.extract = function(v) { | |
return scuts.core.Validations.extractFailure(v); | |
} | |
scuts.core.ValidationFromEither = function() { } | |
scuts.core.ValidationFromEither.__name__ = true; | |
scuts.core.ValidationFromEither.validation = function(e) { | |
return (function($this) { | |
var $r; | |
var $e = (e); | |
switch( $e[1] ) { | |
case 0: | |
var e_eLeft_0 = $e[2]; | |
$r = scuts.core.Validation.Failure(e_eLeft_0); | |
break; | |
case 1: | |
var e_eRight_0 = $e[2]; | |
$r = scuts.core.Validation.Success(e_eRight_0); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.ValidationFromOption = function() { } | |
scuts.core.ValidationFromOption.__name__ = true; | |
scuts.core.ValidationFromOption.validation = function(o,f) { | |
return (function($this) { | |
var $r; | |
var $e = (o); | |
switch( $e[1] ) { | |
case 0: | |
var o_eSome_0 = $e[2]; | |
$r = scuts.core.Validation.Success(o_eSome_0); | |
break; | |
case 1: | |
$r = scuts.core.Validation.Failure(f()); | |
break; | |
} | |
return $r; | |
}(this)); | |
} | |
scuts.core.ValidationFromDynamic = function() { } | |
scuts.core.ValidationFromDynamic.__name__ = true; | |
scuts.core.ValidationFromDynamic.toSuccess = function(x) { | |
return scuts.core.Validation.Success(x); | |
} | |
scuts.core.ValidationFromDynamic.toFailure = function(x) { | |
return scuts.core.Validation.Failure(x); | |
} | |
scuts.core.ValidationFromDynamic.nullToSuccess = function(x,f) { | |
return x != null?scuts.core.Validation.Success(x):scuts.core.Validation.Failure(f()); | |
} | |
scuts.core.debug = {} | |
scuts.core.debug.AssertUsing = function() { } | |
scuts.core.debug.AssertUsing.__name__ = true; | |
scuts.core.debug.AssertUsing.assert = function(ret,expr,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.AssertUsing.assertTrue = function(ret,expr,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.AssertUsing.assertObject = function(ret,val,message,posInfos) { | |
return scuts.core.debug.Assert.isObject(val,ret,message,posInfos); | |
} | |
scuts.core.debug.AssertUsing.assertFail = function(message,posInfos) { | |
return scuts.Scuts.error("fail",{ fileName : "Assert.hx", lineNumber : 119, className : "scuts.core.debug.Assert", methodName : "fail"}); | |
} | |
scuts.core.debug.AssertUsing.assertEquals = function(ret,expected,actual,message,posInfos) { | |
return scuts.core.debug.Assert.equals(expected,actual,ret,message,posInfos); | |
} | |
scuts.core.debug.AssertUsing.assertNotNull = function(ret,a,message,posInfos) { | |
return scuts.core.debug.Assert.notNull(a,ret,message,posInfos); | |
} | |
scuts.core.debug.AssertUsing.assertAllNotNull = function(ret,a,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.AssertUsing.assertNull = function(ret,a,message,posInfos) { | |
return scuts.core.debug.Assert.isNull(a,ret,message,posInfos); | |
} | |
scuts.core.debug.AssertUsing.assertFloatInRange = function(ret,value,min,max,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.AssertUsing.assertIntInRange = function(ret,value,min,max,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.AssertUsing.assertFalse = function(ret,expr,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.AssertUsing.assertType = function(ret,obj,objType,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.AssertUsing.assertClassInstance = function(ret,obj,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.Assert = function() { } | |
scuts.core.debug.Assert.__name__ = true; | |
scuts.core.debug.Assert.doAssert = function(expr,assertId,message,posInfos) { | |
if(!expr) { | |
if(message == null) message = "(no message)"; | |
var posStr = posInfos.fileName + " at " + posInfos.lineNumber + " (" + posInfos.className + "." + posInfos.methodName + ")"; | |
var msg = posStr + ": " + assertId + " failed: " + message; | |
scuts.Scuts.error(msg,posInfos); | |
} | |
} | |
scuts.core.debug.Assert.isTrue = function(expr,ret,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.Assert.isObject = function(val,ret,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.Assert.fail = function(message,posInfos) { | |
return scuts.Scuts.error("fail",{ fileName : "Assert.hx", lineNumber : 119, className : "scuts.core.debug.Assert", methodName : "fail"}); | |
} | |
scuts.core.debug.Assert.equals = function(expected,actual,ret,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.Assert.notNull = function(a,ret,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.Assert.allNotNull = function(a,ret,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.Assert.isNull = function(a,ret,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.Assert.floatInRange = function(value,min,max,ret,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.Assert.intInRange = function(value,min,max,ret,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.Assert.isFalse = function(expr,ret,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.Assert.isType = function(obj,objType,ret,message,posInfos) { | |
return ret; | |
} | |
scuts.core.debug.Assert.isClassInstance = function(obj,ret,message,posInfos) { | |
return ret; | |
} | |
function $iterator(o) { if( o instanceof Array ) return function() { return HxOverrides.iter(o); }; return typeof(o.iterator) == 'function' ? $bind(o,o.iterator) : o.iterator; }; | |
var $_; | |
function $bind(o,m) { var f = function(){ return f.method.apply(f.scope, arguments); }; f.scope = o; f.method = m; return f; }; | |
Math.__name__ = ["Math"]; | |
Math.NaN = Number.NaN; | |
Math.NEGATIVE_INFINITY = Number.NEGATIVE_INFINITY; | |
Math.POSITIVE_INFINITY = Number.POSITIVE_INFINITY; | |
Math.isFinite = function(i) { | |
return isFinite(i); | |
}; | |
Math.isNaN = function(i) { | |
return isNaN(i); | |
}; | |
String.__name__ = true; | |
Array.__name__ = true; | |
Date.__name__ = ["Date"]; | |
var q = window.jQuery; | |
js.JQuery = q; | |
hots.InstEq.floatEq = new hots.instances.FloatEq(); | |
hots.InstEq.intEq = new hots.instances.IntEq(); | |
hots.InstEq.boolEq = new hots.instances.BoolEq(); | |
hots.InstEq.stringEq = new hots.instances.StringEq(); | |
hots.InstEq.dateEq = new hots.instances.DateEq(hots.InstEq.floatEq); | |
hots.InstOrd.floatOrd = new hots.instances.FloatOrd(hots.InstEq.floatEq); | |
hots.InstOrd.intOrd = new hots.instances.IntOrd(hots.InstEq.intEq); | |
hots.InstOrd.stringOrd = new hots.instances.StringOrd(hots.InstEq.stringEq); | |
hots.InstOrd.dateOrd = new hots.instances.DateOrd(hots.InstEq.dateEq,hots.InstOrd.floatOrd); | |
hots.InstOrd.boolOrd = new hots.instances.BoolOrd(hots.InstEq.boolEq); | |
hots.InstShow.stringShow = new hots.instances.StringShow(); | |
hots.InstShow.intShow = new hots.instances.IntShow(); | |
hots.InstShow.floatShow = new hots.instances.FloatShow(); | |
hots.InstNum.intNum = new hots.instances.IntNum(hots.InstEq.intEq,hots.InstShow.intShow); | |
hots.InstFunctor.optionFunctor = new hots.instances.OptionFunctor(); | |
hots.InstFunctor.promiseFunctor = new hots.instances.PromiseFunctor(); | |
hots.InstFunctor.arrayFunctor = new hots.instances.ArrayFunctor(); | |
hots.InstPure.promisePure = new hots.instances.PromisePure(); | |
hots.InstPure.optionPure = new hots.instances.OptionPure(); | |
hots.InstPure.arrayPure = new hots.instances.ArrayPure(); | |
hots.InstEmpty.promiseEmpty = new hots.instances.PromiseEmpty(); | |
hots.InstEmpty.optionEmpty = new hots.instances.OptionEmpty(); | |
hots.InstEmpty.arrayEmpty = new hots.instances.ArrayEmpty(); | |
hots.InstApply.promiseApply = new hots.instances.PromiseApply(); | |
hots.InstApply.optionApply = new hots.instances.OptionApply(); | |
hots.InstApply.arrayApply = new hots.instances.ArrayApply(); | |
hots.InstBind.promiseBind = new hots.instances.PromiseBind(); | |
hots.InstBind.optionBind = new hots.instances.OptionBind(); | |
hots.InstBind.arrayBind = new hots.instances.ArrayBind(); | |
hots.InstApplicative.arrayApplicative = hots.extensions.Applicatives.create(hots.InstPure.arrayPure,hots.InstApply.arrayApply,hots.InstFunctor.arrayFunctor); | |
hots.InstApplicative.promiseApplicative = hots.extensions.Applicatives.create(hots.InstPure.promisePure,hots.InstApply.promiseApply,hots.InstFunctor.promiseFunctor); | |
hots.InstApplicative.optionApplicative = hots.extensions.Applicatives.create(hots.InstPure.optionPure,hots.InstApply.optionApply,hots.InstFunctor.optionFunctor); | |
hots.InstMonad.arrayMonad = hots.extensions.Monads.createFromApplicativeAndBind(hots.InstApplicative.arrayApplicative,hots.InstBind.arrayBind); | |
hots.InstMonad.optionMonad = hots.extensions.Monads.createFromApplicativeAndBind(hots.InstApplicative.optionApplicative,hots.InstBind.optionBind); | |
hots.InstMonad.promiseMonad = hots.extensions.Monads.createFromApplicativeAndBind(hots.InstApplicative.promiseApplicative,hots.InstBind.promiseBind); | |
hots.InstMonadEmpty.arrayMonadEmpty = hots.extensions.MonadEmptys.createFromMonadAndEmpty(hots.InstMonad.arrayMonad,hots.InstEmpty.arrayEmpty); | |
hots.InstMonadEmpty.promiseMonadEmpty = hots.extensions.MonadEmptys.createFromMonadAndEmpty(hots.InstMonad.promiseMonad,hots.InstEmpty.promiseEmpty); | |
hots.InstMonadEmpty.optionMonadEmpty = hots.extensions.MonadEmptys.createFromMonadAndEmpty(hots.InstMonad.optionMonad,hots.InstEmpty.optionEmpty); | |
hots.InstCategory.functionCategory = new hots.instances.FunctionCategory(); | |
hots.InstArrow.functionArrow = new hots.instances.FunctionArrow(hots.InstCategory.functionCategory); | |
hots.InstSemigroup.intSumSemigroup = new hots.instances.IntSumSemigroup(); | |
hots.InstSemigroup.stringSemigroup = new hots.instances.StringSemigroup(); | |
hots.InstSemigroup.intProductSemigroup = new hots.instances.IntProductSemigroup(); | |
hots.InstZero.intSumZero = new hots.instances.IntSumZero(); | |
hots.InstZero.intProductZero = new hots.instances.IntProductZero(); | |
hots.InstZero.stringZero = new hots.instances.StringZero(); | |
hots.InstZero.endoZero = new hots.instances.EndoZero(); | |
hots.InstMonoid.intSumMonoid = new hots.extensions.MonoidDefault(hots.InstSemigroup.intSumSemigroup,hots.InstZero.intSumZero); | |
hots.InstMonoid.intProductMonoid = new hots.extensions.MonoidDefault(hots.InstSemigroup.intProductSemigroup,hots.InstZero.intProductZero); | |
hots.InstMonoid.stringMonoid = new hots.extensions.MonoidDefault(hots.InstSemigroup.stringSemigroup,hots.InstZero.stringZero); | |
hots.InstFoldable.arrayFoldable = new hots.instances.ArrayFoldable(); | |
js.Browser.document = typeof window != "undefined" ? window.document : null; | |
scuts.core.Floats.EPSILON = 1e-5; | |
Animation.main(); | |
})();</script> | |
</body> | |
</html> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment