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.