[Haskell-cafe] Tutorial on JS with Haskell: Fay or GHCJS?

Dmitry Vyal akamaus at gmail.com
Thu Sep 5 12:46:27 CEST 2013

On 09/04/2013 05:39 PM, Adam Bergmark wrote:
> Here are some points I'd like to emphasize in addition to the threads 
> above, with the disclaimer that I'm the maintainer of Fay.
> Fay tries to be very simple, the code base is small (~4800 LoC). This 
> really lowers the entry barrier for contributions which I think is 
> very important for open source projects. GHCJS is much more 
> complicated since it tries to do so much. For GHCJS I'd be afraid that 
> the developers might eventually abandon the project and then it'd be 
> pretty hard to take over development. Much easier for someone to take 
> over Fay development. I think you can safely expect to find bugs in 
> all compilers, and if you do and you are in a hurry you might have to 
> fix it yourself. Fay has very simple output that is close to both 
> Haskell and JavaScript so it's pretty easy to just add a breakpoint 
> and start debugging.
> Even if GHCJS can successfully compile most of hackage, would we want 
> to have these as dependencies in web projects? An output size of 1MiB 
> is nothing when compiling a binary, but for a public website 1MiB can 
> still be quite a lot, add some transitive dependencies and output will 
> explode. Most people don't optimize their packages to have few 
> dependencies, which makes sense since the abstraction usually heavily 
> outweighs code size. So either way you would probably want to write 
> some specific light-weight versions of libraries you want to use, 
> that's one reason both GHCJS and Fay have their own base packages.
> One place I think GHCJS can shine is for non standard web applications 
> such as WEBGL games. Nothing stopping you from using Fay for this, but 
> I expect you can really start to leverage GHCJS's threaded runtime here.

Hi Adam!

We found it to be very convenient to use both Hastec and Fay. Since the 
former (as well, as GHCJS) is based on GHC, you can be quite sure any 
bugs you encounter are yours, not of the compiler. And after your code 
works with Hastec and so your idea is tested, you can try to port it to 
Fay. Usually it's trivial, but prepare to encounter some minor compiler 
deficiencies here and there.

So my proposal to original poster would be to tell a bit about both. 
After all, they represent different approaches to JS generation each 
with it's own pros and cons.


More information about the Haskell-Cafe mailing list