我正在混合旧的 JS 和新的 Fay 生成的 JS,我试图从 Fay 获取一些数据的字符串表示。我定义了
jshow :: Bool -> String
jshow d = show d
它不仅是Bool
真实代码中的 a,而且类型不会改变错误。
这是用
fay Linguatron.hs --strict Linguatron
然后我在 JS 中调用它
Strict.Linguatron.jshow(trainingData);
什么时候trainingData
是我从 JS 调用的另一个 Fay 函数的结果。
这给出了一个未定义的错误,xs
这是在 Fay 标准代码中!它在第 436 行,看起来像
// 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;
}
完整的跟踪是
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
我使用的是 Fey 0.23.1.12,它发生在 Chrome、Safari 和 Firefox 上。