ghcjs / jsaddle

JavaScript interface that works with GHCJS or GHC
118 stars 63 forks source link

JSaddle for GHC Javascript Backend #140

Closed DrewFenwick closed 7 months ago

DrewFenwick commented 1 year ago

If I understand correctly, GHC's new Javascript backend is basically merging the work of GHCJS into GHC proper and as such, GHCJS is dead, long live GHC Javascript backend.

If so JSaddle should be ported to work with GHC's javascript backend. Building under GHC's Javascript backend should set System.Info.arch to javascript and make the CPP macro javascript_HOST_ARCH defined, so the existing conditional compilation should be adaptable.

I'm uncertain how to verify that the compiler is in fact GHC since at the moment, GHCup installed versions of GHC Javascript backend are called the lovely name of javascript-unknown-ghcjs-ghc, so I assume the cabal condition impl(ghc) wouldn't work.

As I understand it, the contents of ghcjs-base have now become part of base proper, so the there should need to be even less cabal conditionals, but I assume conditional compilation is still needed inside the actual Haskell modules.

luite commented 1 year ago

Yes GHCJS isn't being developed anymore, and the GHC JavaScript backend has seen lots of cleanup and fixes, but we haven't quite reached complete feature parity yet.

We can still use the os and arch conditionals to check for the JavaScript target in cabal. I think checks for GHC vs GHCJS can be done with version number checks. GHC 9.6 hasn't been supported by GHCJS. Also GHCJS used to define the __GHCJS__ macro, so if that's not defined we're dealing with the GHC backend instead.

Some ghcjs-prim functionality is now part of base, but ghcjs-base might still be needed. @JoshMeredith has recently been working on GHC support for that package: https://github.com/JoshMeredith/ghcjs-base/tree/hsyl20/js-backend

hamishmack commented 7 months ago

ghcjs-base, jsaddle and ghcjs-dom have been updated in hackage now