<div dir="ltr">I don&#39;t know of any complete implementation. The LLVM code produced by GHC might be hard to compile to JavaScript, since JS does not have tail call optimization. You would also need to get the RTS working, including the garbage collector. It&#39;s written in C and Cmm, both of which can be compiled to LLVM, but often in practice it&#39;s not that easy to get it working properly.<div>
<br></div><div style>We do have a working Haskell compiler based on GHC with GHCJS [1], which uses the GHC API to translate STG code to JavaScript. We do a fairly high-level translation, compiling Haskell closures to JavaScript objects, so that we use as much of the JS runtime, like the garbage collector, as possible. I have spent some time optimizing the performance, making sure that the code is reasonably optimizable by the JS JIT compilers, makes effective use of the inline caches etc, but it&#39;s quite possible that a lower level LLVM/asm.js would give us better performance.</div>
<div style><br></div><div style>For the moment though, we want to concentrate on other things, like getting a release ready before GHC 7.8.1 is out (and getting the patches to support GHCJS merged in GHC), building more libraries, and reducing the size of the generated code.</div>
<div style><br></div><div style>Dan Frumin [2] is working for his Google Summer of Code project on an pastebin that uses GHCJS and the diagrams [3] library that lets the user run the code directly. Generated code supports graphics, functional reactive programming etc, and can be included on other pages. Code is compiled on the server, since GHC itself is a bit too big to compile to JavaScript.</div>
<div style><br></div><div style>For more information on GHCJS, see my weblog [4] [5]. In the past we have already had multiple code generators, if you want to work on one that uses LLVM as the source language we would be happy to add it, and you can use the GHCJS Cabal support, testsuite etc. If it&#39;s clearly better than the existing one, it can replace it one day as the default generator.</div>
<div style><br></div><div style>luite</div><div style><br></div><div style>[1] GHCJS: <a href="https://github.com/ghcjs">https://github.com/ghcjs</a></div><div style>[2] Dan Frumin&#39;s weblog: <a href="http://parenz.wordpress.com/">http://parenz.wordpress.com/</a></div>
<div style>[3] Diagrams library: <a href="http://hackage.haskell.org/package/diagrams">http://hackage.haskell.org/package/diagrams</a></div><div style>[4] GHCJS introduction: <a href="http://weblog.luite.com/wordpress/?p=14">http://weblog.luite.com/wordpress/?p=14</a></div>
<div style>[5] Functional Reactive Programming with GHCJS and sodium: <a href="http://weblog.luite.com/wordpress/?p=127">http://weblog.luite.com/wordpress/?p=127</a></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Fri, Jun 28, 2013 at 3:25 PM, B B <span dir="ltr">&lt;<a href="mailto:blackbox.dev.ml@gmail.com" target="_blank">blackbox.dev.ml@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Hi!<div>Does anybody tried, or is there anywhere a project, of online ghc or ghci (compiled to JavaScript with Emscripten)?</div></div>
<br>_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br></div>