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 - and it should work as expected.
We are creating an online graphics (HTML5 canvas, webgl) processing tool - we want to use Haskell as our processing language and we want allow users to interactively process graphics in a functional, lazy manner. We want GHCI to be run inside browser, to allow for smooth work.
There are a lot of interpreters (like python or ruby) compiled to javascript using emscripten.
Would it be possible to compile the GHCI (written in haskell?) with GHC -fllvm to IR bitcode and then to javascript to get the online GHCI interpreter? (not such "online" tools like "Try Haskell", which under the hood compute everything on server)