UHC-like JavaScript backend in GHC

J. Stutterheim j.stutterheim at me.com
Tue Nov 13 16:33:25 CET 2012

On 13 Nov 2012, at 16:17, Simon Peyton-Jones <simonpj at microsoft.com> wrote:

> | currently doing. Before I get started: does the GHC architecture
> | currently allow for adding a new calling convention which departs from
> | the conventional C FFIs and introduces a custom RTS?
> GHC certainly supports new back ends.  You'd probably want to replace the entire back end, and go from optimised Core to Javascript.  Should be entirely feasible. 

Good to hear!

> I'm sure you are checking out all relevant stuff, but you don't mention:
> http://www.haskell.org/haskellwiki/STG_in_Javascript
> http://article.gmane.org/gmane.comp.lang.haskell.cafe/88970
> https://plus.google.com/102016502921512042165/posts/Z7NtU4eF8Zh

Yes, I did check out other work that's been done in this area, albeit only briefly. Unless I've overlooked it (which is very much possible), none of the other solutions (except Fay) support an FFI that bridges the gap between JS's OO and the functional world, like our JS-like language in the foreign imports. In real-life situations, where you want to get rid of writing JS entirely, but still might want to use existing JS libraries such as jQuery, this feature is essential.

> Difficulties may be in supporting all of GHC stuff, esp concurrency. Eg the I/O library depends heavily on concurrency, so you may need to replace it entirely.

This is indeed a tricky part, and it might not be possible to map all of it to JS, so replacing it entirely is not an unlikely option. It might be possible to implement fork in terms of WebWorkers, though.

> Keep us posted!  

Will do :)


> Simon
> If not, where are
> | the current major bottlenecks? And would it be possible to remove these
> | bottlenecks, without significantly affecting the compilation times, and
> | without affecting the performance of generated native code (when the JS
> | backend is not used)?
> | 
> | Any input on this is appreciated :)
> | 
> | Cheers,
> | 
> | 
> | Jurriën
> | 
> | 
> | [1] http://uu-computerscience.github.com/uhc-js/
> | [2] http://fay-lang.org
> | _______________________________________________
> | Glasgow-haskell-users mailing list
> | Glasgow-haskell-users at haskell.org
> | http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

More information about the Glasgow-haskell-users mailing list