Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Locating Javascript libraries for FFI

Tags:

haskell

ffi

ghcjs

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.

like image 441
Sal Avatar asked Nov 10 '22 06:11

Sal


1 Answers

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.

like image 103
Cactus Avatar answered Nov 15 '22 07:11

Cactus