2

I'm trying to set up Yesod, while running Fay for the frontend of my site. It's mostly working as I'd expect, as in any Fay I write runs. The problem is I'm getting an Uncaught ReferenceError in the generated JS.

Here is a short version of the JS in question:

(function(){
var Data = {};Data.Data = {};var Fay = {}; ... lots of code ... Home.main = new Fay$$$(function(){return Fay$$_(Home.alert)(Fay$$list("test"));});
;
Fay$$_(Home.main);
})();
Fay$$_(Home.main); /* Uncaught ReferenceError: Home is not defined */

And the Fay code that generates it:

module Home where

import Prelude
import Fay.FFI
import Language.Fay.Yesod
import SharedTypes


alert :: String -> Fay ()
alert = ffi "window.alert(%1)"

main :: Fay ()
main = alert "test"

I suspect that the extra call is being added by the yesod-fay package, but I'm not sure how to avoid this happening. https://github.com/fpco/yesod-fay/blob/master/Yesod/Fay.hs#L124 is the function I think might be involved.

LeeG
  • 265
  • 1
  • 4
  • 11
  • I have the exact same problem. It seems pretty harmless, though I rather have it work without it. For the record: the problem also exists with the `pf` app template of `yesod init`. – cies Apr 12 '14 at 20:28
  • I've raised an issue for it at Github: https://github.com/fpco/yesod-fay/issues/6 – cies Apr 12 '14 at 20:32

0 Answers0