@@ -6,8 +6,8 @@ Elm.Native.Regex.make = function(elm) {
6 if ('values' in Elm.Native.Regex)
6 if ('values' in Elm.Native.Regex)
7 return elm.Native.Regex.values = Elm.Native.Regex.values;
7 return elm.Native.Regex.values = Elm.Native.Regex.values;
9+ var List = Elm.List.make(elm);
9 var Maybe = Elm.Maybe.make(elm);
10 var Maybe = Elm.Maybe.make(elm);
10− var JS = Elm.JavaScript.make(elm);
12 function escape(str) {
12 function escape(str) {
13 return str.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
13 return str.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
@@ -20,14 +20,14 @@ Elm.Native.Regex.make = function(elm) {
22 function contains(re, string) {
22 function contains(re, string) {
23− return JS.fromString(string).match(re) !== null;
23+ return string.match(re) !== null;
26 function find(n, re, str) {
26 function find(n, re, str) {
27 n = n.ctor === "All" ? Infinity : n._0;
27 n = n.ctor === "All" ? Infinity : n._0;
28 var out = [];
28 var out = [];
29 var number = 0;
29 var number = 0;
30− var string = JS.fromString(str);
30+ var string = str;
31 var result;
31 var result;
32 while (number++ < n && (result = re.exec(string))) {
32 while (number++ < n && (result = re.exec(string))) {
33 var i = result.length - 1;
33 var i = result.length - 1;
@@ -36,17 +36,17 @@ Elm.Native.Regex.make = function(elm) {
36 var submatch = result[i];
36 var submatch = result[i];
37 subs[--i] = submatch === undefined
37 subs[--i] = submatch === undefined
38 ? Maybe.Nothing
38 ? Maybe.Nothing
39− : Maybe.Just(JS.toString(submatch));
39+ : Maybe.Just(submatch);
41 out.push({
41 out.push({
43− match: JS.toString(result[0]),
43+ match: result[0],
44− submatches: JS.toList(subs),
44+ submatches: List.fromArray(subs),
45 index: result.index,
45 index: result.index,
46 number: number,
46 number: number,
49− return JS.toList(out);
49+ return List.fromArray(out);
52 function replace(n, re, replacer, string) {
52 function replace(n, re, replacer, string) {
@@ -60,24 +60,24 @@ Elm.Native.Regex.make = function(elm) {
60 var submatch = arguments[i];
60 var submatch = arguments[i];
61 submatches[--i] = submatch === undefined
61 submatches[--i] = submatch === undefined
62 ? Maybe.Nothing
62 ? Maybe.Nothing
63− : Maybe.Just(JS.toString(submatch));
63+ : Maybe.Just(submatch);
65− return JS.fromString(replacer({
65+ return replacer({
67 match:match,
67 match:match,
68− submatches:JS.toList(submatches),
68+ submatches:List.fromArray(submatches),
69 index:arguments[i-1],
69 index:arguments[i-1],
70 number:count
70 number:count
73 return string.replace(re, jsReplacer);
73 return string.replace(re, jsReplacer);
76 function split(n, re, str) {
76 function split(n, re, str) {
77 if (n === Infinity) {
77 if (n === Infinity) {
78− return JS.toList(JS.fromString(string).split(re));
78+ return List.fromArray(string.split(re));
80− var string = JS.fromString(str);
80+ var string = str;
81 var result;
81 var result;
82 var out = [];
82 var out = [];
83 var start = re.lastIndex;
83 var start = re.lastIndex;
@@ -87,7 +87,7 @@ Elm.Native.Regex.make = function(elm) {
87 start = re.lastIndex;
87 start = re.lastIndex;
89 out.push(string.slice(start));
89 out.push(string.slice(start));
90− return JS.toList(out);
90+ return List.fromArray(out);
93 return Elm.Native.Regex.values = {
93 return Elm.Native.Regex.values = {