@@ -1,7 +1,7 @@
11Elm.List = function() {
22
33 var throwError = function(f) {
4− throw "Function '" + f + "' expecting a list!";
4+ throw new Error("Function '" + f + "' expecting a list!");
55 }
66
77 function length(xs) {
@@ -46,19 +46,19 @@ Elm.List = function() {
4646 var minimum = foldl1(function(x) { return function(y) { return Math.min(x,y) } });
4747 function head(v) {
4848 if (v[0] !== "Cons") {
49− throw "Error: 'head' only accepts lists of length greater than one.";
49+ throw new Error("Error: 'head' only accepts lists of length greater than one.");
5050 }
5151 return v[1];
5252 }
5353 function tail(v) {
5454 if (v[0] !== "Cons") {
55− throw "Error: 'tail' only accepts lists of length greater than one.";
55+ throw new Error("Error: 'tail' only accepts lists of length greater than one.");
5656 }
5757 return v[2];
5858 }
5959 function last(v) {
6060 if (v[0] !== "Cons") {
61− throw "Error: 'last' only accepts lists of length greater than one.";
61+ throw new Error("Error: 'last' only accepts lists of length greater than one.");
6262 }
6363 var out = v[1];
6464 while (v[0] === "Cons") {
@@ -129,7 +129,7 @@ Elm.List = function() {
129129 }
130130 function foldr1(f) {
131131 return function(xs) {
132− if (xs[0] === "Nil") { throw "'foldr1' requires an non-empty list." }
132+ if (xs[0] === "Nil") { throw new Error("'foldr1' requires an non-empty list.") }
133133 if (xs[0] !== "Cons") { throwError('foldr1'); }
134134 var arr = [];
135135 while (xs[0] === "Cons") {
@@ -165,7 +165,7 @@ Elm.List = function() {
165165 function scanl1(f) {
166166 return function(xs) {
167167 if (xs[0] !== "Cons") {
168− throw "Error: 'scanl1' requires a list of at least length 1.";
168+ throw new Error("Error: 'scanl1' requires a list of at least length 1.");
169169 }
170170 return scanl(f)(xs[1])(xs[2]);
171171 }