@@ -6,8 +6,8 @@ Elm.Native.Regex.make = function(elm) {
66 if ('values' in Elm.Native.Regex)
77 return elm.Native.Regex.values = Elm.Native.Regex.values;
88
9+ var List = Elm.List.make(elm);
910 var Maybe = Elm.Maybe.make(elm);
10− var JS = Elm.JavaScript.make(elm);
1111
1212 function escape(str) {
1313 return str.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
@@ -20,14 +20,14 @@ Elm.Native.Regex.make = function(elm) {
2020 }
2121
2222 function contains(re, string) {
23− return JS.fromString(string).match(re) !== null;
23+ return string.match(re) !== null;
2424 }
2525
2626 function find(n, re, str) {
2727 n = n.ctor === "All" ? Infinity : n._0;
2828 var out = [];
2929 var number = 0;
30− var string = JS.fromString(str);
30+ var string = str;
3131 var result;
3232 while (number++ < n && (result = re.exec(string))) {
3333 var i = result.length - 1;
@@ -36,17 +36,17 @@ Elm.Native.Regex.make = function(elm) {
3636 var submatch = result[i];
3737 subs[--i] = submatch === undefined
3838 ? Maybe.Nothing
39− : Maybe.Just(JS.toString(submatch));
39+ : Maybe.Just(submatch);
4040 }
4141 out.push({
4242 _:{},
43− match: JS.toString(result[0]),
44− submatches: JS.toList(subs),
43+ match: result[0],
44+ submatches: List.fromArray(subs),
4545 index: result.index,
4646 number: number,
4747 });
4848 }
49− return JS.toList(out);
49+ return List.fromArray(out);
5050 }
5151
5252 function replace(n, re, replacer, string) {
@@ -60,24 +60,24 @@ Elm.Native.Regex.make = function(elm) {
6060 var submatch = arguments[i];
6161 submatches[--i] = submatch === undefined
6262 ? Maybe.Nothing
63− : Maybe.Just(JS.toString(submatch));
63+ : Maybe.Just(submatch);
6464 }
65− return JS.fromString(replacer({
65+ return replacer({
6666 _:{},
6767 match:match,
68− submatches:JS.toList(submatches),
68+ submatches:List.fromArray(submatches),
6969 index:arguments[i-1],
7070 number:count
71− }));
71+ });
7272 }
7373 return string.replace(re, jsReplacer);
7474 }
7575
7676 function split(n, re, str) {
7777 if (n === Infinity) {
78− return JS.toList(JS.fromString(string).split(re));
78+ return List.fromArray(string.split(re));
7979 }
80− var string = JS.fromString(str);
80+ var string = str;
8181 var result;
8282 var out = [];
8383 var start = re.lastIndex;
@@ -87,7 +87,7 @@ Elm.Native.Regex.make = function(elm) {
8787 start = re.lastIndex;
8888 }
8989 out.push(string.slice(start));
90− return JS.toList(out);
90+ return List.fromArray(out);
9191 }
9292
9393 return Elm.Native.Regex.values = {