Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-07-03 Thread B B
Emscripten is meant to translate ANY LLVM IR code to javascript and it should work (as I belive). I've tried to compile 'hello wrold' Haskell program to JS using Emscripten but I faced a problem, that in generated LLVM IR code there is no C-like main function

Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-07-03 Thread Luite Stegeman
On Wed, Jul 3, 2013 at 11:06 AM, B B blackbox.dev...@gmail.com wrote: Emscripten is meant to translate ANY LLVM IR code to javascript and it should work (as I belive). It cannot compile ANY LLVM code: It's heavily geared towards porting C and C++ code to JavaScript, and still there are some

Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-07-03 Thread B B
Thank you for your response :) Could you please answer one additional question - why you, while creating GHCJS didn't base on emscripten? Why haven't you patched it and created custom solution? Is GHCJS production ready? Also - Can I use GHCJS to compile big projects (like GHC or GHCI) to

Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-07-03 Thread Luite Stegeman
On Wed, Jul 3, 2013 at 12:26 PM, B B blackbox.dev...@gmail.com wrote: Thank you for your response :) Could you please answer one additional question - why you, while creating GHCJS didn't base on emscripten? Why haven't you patched it and created custom solution? I didn't know a good way to

Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-07-03 Thread B B
I think GHCJS should be able to compile all Haskell code in GHC, but we haven't tested this yet. The tricky bit is probably getting foreign code work, and creating a working installation that includes all other things, like libraries and a package database. Usually, GHCi loads object files

Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-07-03 Thread Brandon Allbery
On Wed, Jul 3, 2013 at 6:26 AM, B B blackbox.dev...@gmail.com wrote: Could you please answer one additional question - why you, while creating GHCJS didn't base on emscripten? Why haven't you patched it and created custom solution? I'd like to point out that the LLVM code from GHC is

Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-07-03 Thread Luite Stegeman
On Wed, Jul 3, 2013 at 3:13 PM, B B blackbox.dev...@gmail.com wrote: I think GHCJS should be able to compile all Haskell code in GHC, but we haven't tested this yet. The tricky bit is probably getting foreign code work, and creating a working installation that includes all other things, like

Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-07-03 Thread Luite Stegeman
Similarly I would expect that generating any sort of sensible Javascript would require something fairly tightly tied to GHC; otherwise the output's going to have horrible performance because it's not going to understand the input and will fall back to the slowest but most general translation.

Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-07-03 Thread Daniel Frumin
On Jul 3, 2013, at 5:13 PM, B B blackbox.dev...@gmail.com wrote: I think GHCJS should be able to compile all Haskell code in GHC, but we haven't tested this yet. The tricky bit is probably getting foreign code work, and creating a working installation that includes all other things,

Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-07-02 Thread B B
Thank you for all the replies. Luite Stegeman - I was thinking that the LLVM IR code is optimized already or you can run LLVM IR optimization passes to get rid of such things. I think compiling with ghc -fllvm generates LLVM bitcode and then you can simply run emscripten on it to get Javascript -

Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-07-02 Thread Luite Stegeman
On Tue, Jul 2, 2013 at 4:38 PM, B B blackbox.dev...@gmail.com wrote: Thank you for all the replies. Luite Stegeman - I was thinking that the LLVM IR code is optimized already or you can run LLVM IR optimization passes to get rid of such things. I think compiling with ghc -fllvm generates LLVM

[Haskell-cafe] ghci ghc - JS (Emscripten)

2013-06-28 Thread B B
Hi! Does anybody tried, or is there anywhere a project, of online ghc or ghci (compiled to JavaScript with Emscripten)? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-06-28 Thread Luite Stegeman
I don'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's written in C and Cmm, both of which can be compiled to

Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-06-28 Thread Henk-Jan van Tuyl
On Fri, 28 Jun 2013 15:25:59 +0200, B B blackbox.dev...@gmail.com wrote: Hi! Does anybody tried, or is there anywhere a project, of online ghc or ghci (compiled to JavaScript with Emscripten)? There is Try Haskell![0], source code can be found on GitHub[1] Regards, Henk-Jan van Tuyl [0]

Re: [Haskell-cafe] ghci ghc - JS (Emscripten)

2013-06-28 Thread Tikhon Jelvis
My understanding is that Try Haskell actually runs the submitted code on a server with mueval rather than compiling it to JavaScript and running it in the client. This is different from some of the other try websites (like try.ocamlpro.com), so it's easy to get confused. On Fri, Jun 28, 2013 at