2Elm.Native.Utils = function(elm) {
5 elm.Native = elm.Native || {};
6 if (elm.Native.Utils) return elm.Native.Utils;
9 if (x === y) return true;
10 if (typeof x === "object") {
12 for (var i in x) { ++c; if (!eq(x[i],y[i])) return false; }
13 return c === Object.keys(y).length;
15 if (typeof x === 'function') {
16 throw new Error('Equality error: general function equality is ' +
17 'undecidable, and therefore, unsupported');
22 var EQ = 0, LT = 1, GT = 2, ord = ['EQ','LT','GT'];
23 function compare(x,y) { return { ctor: ord[cmp(x,y)] } }
25 if (typeof x !== 'object') return x === y ? EQ : x < y ? LT : GT;
27 if (x.ctor === "Cons" || x.ctor === "Nil") {
29 if (x.ctor === "Nil" && y.ctor === "Nil") return EQ;
30 if (x.ctor !== y.ctor) return {ctor: x.ctor==='Nil'?LT:GT};
31 var ord = cmp(x._0, y._0);
32 if (ord !== EQ) return ord;
37 if (x.ctor.slice(0,5) === 'Tuple') {
38 var n = x.ctor.slice(5) - 0;
39 var err = 'cannot compare tuples with more than 6 elements.';
40 if (n === 0) return EQ;
41 if (n >= 1) { ord = cmp(x._0, y._0); if (ord !== EQ) return ord;
42 if (n >= 2) { ord = cmp(x._1, y._1); if (ord !== EQ) return ord;
43 if (n >= 3) { ord = cmp(x._2, y._2); if (ord !== EQ) return ord;
44 if (n >= 4) { ord = cmp(x._3, y._3); if (ord !== EQ) return ord;
45 if (n >= 5) { ord = cmp(x._4, y._4); if (ord !== EQ) return ord;
46 if (n >= 6) { ord = cmp(x._5, y._5); if (ord !== EQ) return ord;
47 if (n >= 7) throw new Error('Comparison error: ' + err); } } } } } }
50 throw new Error('Comparison error: comparison is only defined on ints, ' +
51 'floats, times, chars, strings, lists of comparable values, ' +
52 'and tuples of comparable values.')
56 var Tuple0 = { ctor: "Tuple0" };
57 function Tuple2(x,y) { return { ctor:"Tuple2", _0:x, _1:y } }
60 function guid(_) { return count++ }
64 for (var i in r) { o[i] = r[i]; }
68 function remove(x,r) {
72 o._[x] = o._[x].slice(1);
73 if (o._[x].length === 0) { delete o._[x]; }
80 function replace(kvs,r) {
82 for (var i = kvs.length; i--; ) {
89 function insert(x,v,r) {
91 if (x in o) o._[x] = [o[x]].concat(x in o._ ? o._[x].slice(0) : []);
96 function max(a,b) { return a > b ? a : b }
97 function min(a,b) { return a < b ? a : b }
99 function htmlHeight(width, html) {
100 var t = document.createElement('div');
102 if (width > 0) { t.style.width = width + "px"; }
103 t.style.visibility = "hidden";
104 t.style.styleFloat = "left";
105 t.style.cssFloat = "left";
107 elm.node.appendChild(t);
108 var w = t.clientWidth;
109 var h = t.clientHeight;
110 elm.node.removeChild(t);
114 return elm.Native.Utils = {
127 htmlHeight: F2(htmlHeight),
128 toFloat: function(x){return x}
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list