@@ -30,11 +30,15 @@ Elm.Native.Utils.make = function(elm) {
3030 function compare(x,y) { return { ctor: ord[cmp(x,y)+1] } }
3131 function cmp(x,y) {
3232 var ord;
33− if (typeof x !== 'object' || x instanceof String){
33+ if (typeof x !== 'object'){
3434 return x === y ? EQ : x < y ? LT : GT;
3535 }
36−
37− if (x.ctor === "::" || x.ctor === "[]") {
36+ else if (x.isChar){
37+ var a = x.toString();
38+ var b = y.toString();
39+ return a === b ? EQ : a < b ? LT : GT;
40+ }
41+ else if (x.ctor === "::" || x.ctor === "[]") {
3842 while (true) {
3943 if (x.ctor === "[]" && y.ctor === "[]") return EQ;
4044 if (x.ctor !== y.ctor) return x.ctor === '[]' ? LT : GT;
@@ -44,8 +48,7 @@ Elm.Native.Utils.make = function(elm) {
4448 y = y._1;
4549 }
4650 }
47−
48− if (x.ctor.slice(0,6) === '_Tuple') {
51+ else if (x.ctor.slice(0,6) === '_Tuple') {
4952 var n = x.ctor.slice(6) - 0;
5053 var err = 'cannot compare tuples with more than 6 elements.';
5154 if (n === 0) return EQ;
@@ -58,9 +61,11 @@ Elm.Native.Utils.make = function(elm) {
5861 if (n >= 7) throw new Error('Comparison error: ' + err); } } } } } }
5962 return EQ;
6063 }
61− throw new Error('Comparison error: comparison is only defined on ints, ' +
62− 'floats, times, chars, strings, lists of comparable values, ' +
63− 'and tuples of comparable values.')
64+ else {
65+ throw new Error('Comparison error: comparison is only defined on ints, ' +
66+ 'floats, times, chars, strings, lists of comparable values, ' +
67+ 'and tuples of comparable values.');
68+ }
6469 }
6570
6671