16 ms·
How does this deal with calling arbitrary JS code from Haskell? For example, how would I use jQuery from Haste? Looks like a cool project, but that's the first
by egonschiele 13y ago
How does this deal with calling arbitrary JS code from Haskell? For example, how would I use jQuery from Haste? Looks like a cool project, but that's the first thing I want to know for X to JS compilers.
- deleted 13y ago[deleted]
- evincarofautumn 13y agoYou 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/js-externals.txt https://github.com/valderman/haste-compiler/blob/master/doc/...
- marshray 13y agojQuery seems to be particularly dynamic even as far as Javascript libraries go, but here's how Typescript handles it: https://typescript.codeplex.com/SourceControl/latest#typings/jquery.d.ts https://typescript.codeplex.com/SourceControl/latest#typings...
- fosap 13y agoSince jQuery is a monad i expect a Haskell wrapper to be written very soon.
- evincarofautumn 13y agoYou had better be joking.