JavaScript backend has landed in GHC

The GHCJS based JavaScript backend has landed in master: JavaScript backend merged into GHC | IOG Engineering

Aright now time to get back to make sure the CI actually runs the GHC testsuite on the JS backend :slight_smile:

cc @hsyl20

27 Likes

Nice :ok_hand:

Interested to know how the usability would compare with Purescript?

Just it’s fairly easy to port any JS library ie React via FFI in Purescript. Thus having most of the JS ecosystem at your feet (given one takes the time to FFI a library). Also last time I used PS it’s compilations was rather performant :thinking:

1 Like

Exciting times!

Looking forward to update my few GHCJS using projects to just use GHC.

2 Likes

Congratulations! This is so exciting :slight_smile:

I’m curious whether Miso/Reflex are thinking of updating to use this new port soon? What frontend tools does IOG use that pushed them to perform this upstreaming?

3 Likes

@dmjio any updates on this?

1 Like

Considering the prevailing attitude towards JavaScript e.g:

…is building a back-section specifically for that ol’ warhorse such a good long-term investment - would a better Internet-centric option be the new WebAssembly back-section:

…which (presumably) could then be used to support or supersede JavaScript? Granted, WebAssembly isn’t perfect either e.g. it’s data formats not being network endian, but several other widely-used programming languages already or will have wasm support in the next few years…as opposed to supporting JavaScript.

If the old back-section for C was demoted from regular use in GHC, to then add a new back-section for JavaScript seems somewhat anachronistic…

@doyougnu, is there a nix derivation and cache somewhere that I can use to play around with this, without building it myself?

The JavaScript backend is already upstreamed in nixpkgs: https://github.com/NixOS/nixpkgs/pull/208947

4 Likes

If you want to build from source (instead of pulling from nixpkgs) then you should use ghc.nix and follow the build instructions in the wiki: javascript backend · Wiki · Glasgow Haskell Compiler / GHC · GitLab

if you end up having issues with the llvm version then you’ll need to use my patched version of ghc.nix here: GitHub - doyougnu/ghc.nix: Nix (shell) expression for working on GHC althoug it looks like nixpkgs have a better solution so perhaps its time to update ghc.nix upstream!