I'm mixing old JS and new Fay-generated JS, and I'm trying to get a string representation of some data from Fay. I defined
jshow :: Bool -> String
jshow d = show d
It's not just a Bool
in the real code, but the type doesn't change the error.
This is compiled with
fay Linguatron.hs --strict Linguatron
And then I call it in JS with
Strict.Linguatron.jshow(trainingData);
when trainingData
is the result from another Fay function which I call from JS.
This gives an error that xs
is undefined, and this is inside the Fay standard code! It's on line 436, which looks like
// Make a list.
function Fay$$list(xs){
var out = null;
for(var i=xs.length-1; i>=0;i--) //<<-- This line
out = new Fay$$Cons(xs[i],out);
return out;
}
The full trace is
Fay$$list @ linguatron.js:436
Fay$$jsToFay_string @ linguatron.js:281
(anonymous function) @ linguatron.js:822
Fay$$$.force @ linguatron.js:52
Fay$$_ @ linguatron.js:29
(anonymous function) @ linguatron.js:173
(anonymous function) @ main.js:56
m.event.dispatch @ jquery.js:4670
r.handle @ jquery.js:4338
I'm using Fey 0.23.1.12 and it happens on Chrome, Safari, and Firefox.