I am digging through ghcjs-jquery
code to see how JavascriptFFI
works. What I am trying to figure out is that once you define FFI import type signature for a JS function, how do you help ghcjs
locate the file containing the function.
Checking Internal.hs
and Cabal configuration, I don't see any way to specify the path of the JQuery JS files. I also looked around for documentation on JavascriptFFI
feature but haven't found anything. I will appreciate pointers on how to do Javascript FFI in ghcjs
for any JS library. There must be some command-line option to ghcjs
to tell it where to locate the js
files.
I am planning to play with dojo library functions after I figure out JavascriptFFI
feature of ghcjs
.
You need to take care of loading those Javascript files yourself in the page that you use the GHCJS-generated Javascript. GHCJS doesn't need to find the actual definition of the referenced Javascript functions -- it takes for granted whatever type you add in your foreign
declaration.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With