
I've been toying with the idea of compiling Haskell, or at least a subset there-of into JavaScript. It's an interesting technical problem, and has lead to some fun coding. The idea is basically that for each Haskell syntax construct, an equivalent construct can be created in JavaScript, though perhaps in many more words. Then of course there is the need to support a mapping for the Prelude and a library to access JavaScript functionality like DOM traversal in the browser. I'm not sure if there any major technical barriers. What I see as being dangerous is performance, as Haskell is not designed to be JavaScript and the JavaScript I've produced so far is very wordy compared to hand-written JavaScript, but I haven't delved into performance issues yet. I also haven't bothered trying to interface with external Javascript. The benefits would be that you get all the terseness and compile-time checks of Haskell, which would eliminate some of the headaches I have with JavaScript. Right now though, I'm not going to have time to finish to use it on my next project, so it has fallen to the wayside. Would something like this be valuable? Are there any major limitations I've overlooked? Drew Haven