For those interested in ES5 vs ES3 … it’s ES5. Trying to parse as ES3 chokes here:
var _String_filter = F2(function(isGood, str)
{
var arr = [];
var len = str.length;
var i = 0;
while (i < len)
{
var char = str[i];
Parsing error: The keyword 'char' is reserved
Renaming those, it chokes on:
var _Bytes_read_string = F3(function(len, bytes, offset)
{
var string = '';
var end = offset + len;
for (; offset < end;)
{
var byte = bytes.getUint8(offset++);
Parsing error: The keyword 'byte' is reserved
But fixing those, it parsed!
Naming a record field char
seems to work too. (Ah, the compiler supports avoiding ES3-only reserved words: https://github.com/elm/compiler/blob/2f6dd29258e880dbb7effd57a829a0470d8da48b/compiler/src/Generate/JavaScript/Name.hs#L134-L147)
Here’s an ES5 method usage:
function _String_trim(str)
{
return str.trim();
}
It can still be polyfilled though.