You just make an FFI declaration in Haskell:
foreign import ccall square :: Int -> Int
And use --with-js to link against a JS file: // square.js
function square(x) {
return x * x;
}
Using jQuery would be an interesting challenge. I suppose you could just get the jQuery object and go nuts on it unsafely, or write typesafe(ish) wrapper functions to export. The “ccall” convention is also a bit disingenuous.Source: https://github.com/valderman/haste-compiler/blob/master/doc/...