[Haskell-cafe] GHCJS/Firefox support for forkIO and MVars

Hamish Mackenzie hamish.k.mackenzie at googlemail.com
Mon May 30 17:53:37 CEST 2011


Firstly a big thanks to Neil Mix for this threading library...
http://www.neilmix.com/2007/02/07/threading-in-javascript-17/
It is just what GHCJS needs for threading support (at least in Firefox).

Here is what I did to get it working in GHCJS...
 * Added "Jump" so that tail calls don't grow the stack
 * Implemented a really basic scheduler
 * Added some thread and MVar primitives
 * Added a YieldTrampoline calling convention to GHCJS

The code is here https://github.com/hamishmack/ghcjs

cabal install
cd examples
runhaskell BuildTestYield.hs ../../ghc-7.0.2

Then open test-yield.html in Firefox.

I think you can build it with any GHC 7 (I used 7.0.3), but you need the 7.0.2 source.  I get this error when I try to use the 7.0.3 source... 

../../ghc-7.0.3/libraries/base/GHC/Unicode.hs:35:0:
     error: HsBaseConfig.h: No such file or directory





More information about the Haskell-Cafe mailing list