[Haskell-cafe] Experimental GHC with GHCJS built in and Cabal support for JavaScript files

Mathijs Kwik bluescreen303 at gmail.com
Sat May 14 21:29:42 CEST 2011


Wow, this is great news.
(still compiling, so didn't even try it out yet)

Will it be possible to interface (from/to) with native javascript
functions in this release?
And are there any packages that provide the objects/functions provided
by the DOM?

Thanks for continuing ghcjs. I was beginning to fear people didn't
mind to code JS by hand :P



On Sat, May 14, 2011 at 7:44 PM, Hamish Mackenzie
<hamish.k.mackenzie at googlemail.com> wrote:
> Blackh and I have been trying out some ideas on how to make it easier use GHCJS in your Cabal projects.  We took Victor's GHCJS code and added it back into GHC (we could not easily accomplish what we wanted using the current GHC API).  We set it up so that GHC outputs a .js file whenever it outputs an object file.  We added code to Cabal to install the .js files (in the same place as the .hi files).  At link time GHC copies all the .js files from the packages used into a .jsexe directory (with the same name and in the same location as the executable).  Finally when the executable is installed we copy the .jsexe directory along with it.  Only files with differing modified dates are copied to avoid slowing things down too much.
>
> I have updated my yesod-slides example to show how all this can be used.
>
> https://github.com/hamishmack/yesod-slides
>
> The README.mardown there has instructions for building GHC and Cabal with the GHCJS stuff in it.  It is a bit painful to build, but the changes to yesod-slides were quite minor...
>  * Added ghcjs-rts to the build depends
>  * Published the yesod-slides.jsexe folder (using Yesod's staticFiles)
>  * Added <script> tags to <head> for rts-common.js and rts-plain.js
>  * Added Julius script to init the rts
>
> Currently GHC is hard coded to use the GHCJS Trampoline calling convention (in GHC's HscMain.hs).
>
> Hamish
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



More information about the Haskell-Cafe mailing list