

Haste – A Haskell to JS Compiler - freqheist
http://hackage.haskell.org/package/haste-compiler

======
cies
Here the discussion on reddit.com/r/haskell:

[http://www.reddit.com/r/haskell/comments/1htqi2/announce_has...](http://www.reddit.com/r/haskell/comments/1htqi2/announce_haste_the_haskell_to_js_compiler_is_now)

That's the place where most intensive discussion on this kind of news usually
takes place... (which holds true for this piece of news too)

edit: The reddit discussion contains an well written overview of differences
between haste, ghcjs and fay (the 3 main haskell-to-js projects).

------
marshray
Is it just me or does not a week go by without another FP-to-Javascript
compiler project?

I love this trend, but I'd really love to see an asm.js target. GHC uses LLVM,
which has such a backend, right?

Edit: previously I said 'Clang' instead of 'LLVM'

~~~
munificent
> I love this trend, but I'd really love to see an asm.js target.

Why? Is "asm.js" just a mnemonic for "magically fast", or is there something
specific you think would be gained by not using the full target language JS as
a compiler target?

~~~
foobarbazqux
asm.js is designed for static compilation, there's no magic.

------
Zariel
It is probably more useful to link to the github page
[https://github.com/valderman/haste-
compiler](https://github.com/valderman/haste-compiler)

------
miga
Having JS, ARM, and Intel compilers now make Haskell a multi-platform tool of
choice among discriminating hackers ;-).

Let's just wait for GHCi support on both JS and ARM.

~~~
cantankerous
Just port over the GHC monad and you're golden ;-).

------
aroberge
Having never used Haskell, I do not know if it would be possible to use it on
itself so as to be able to run sample haskell test programs entered by a user
on a web page.

------
tieTYT
How can it support cabal? Is that only for other Haste libraries? Most haskell
cabal dependencies end up needing a native library (eg: compiled c files)
somewhere in their transitive dependencies (this is very unfortunate, btw).

~~~
ocharles
Integrates with Cabal might mean that Haste can be installed with Cabal, but
I'm not sure (ghcjs for example cannot).

------
egonschiele
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.

~~~
evincarofautumn
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/...](https://github.com/valderman/haste-
compiler/blob/master/doc/js-externals.txt)

~~~
fosap
Since jQuery is a monad i expect a Haskell wrapper to be written very soon.

~~~
evincarofautumn
You had better be joking.

