I think it also depends on what exactly you're trying to do. If you're trying to do client side scripting using Haskell (much the way JS is used currently), that is including a Haskell "script" from some page that's intended to be executed on the client, you can't really do that. As Mathijs pointed out there are some projects that can let you use Haskell to generate JavaScript which provides a reasonable measure of safety (in much the same way that the final binary generated from Haskell is still safe even though machine code itself isn't), although isn't exactly the same thing. If all you want to do is execute some Haskell code inside of the browser process you could always us FFI to use the C plugin hooks to create a Haskell based plugin. Doing that and using something like hint you could even embed a Haskell "interpreter" inside of the browser, but of course you couldn't rely on something like that being available on any browser except your own.

-R. Kyle Murphy
--
Curiosity was framed, Ignorance killed the cat.


On Mon, Oct 26, 2009 at 03:22, Mathijs Kwik <bluescreen303@gmail.com> wrote:
There used to be http://www.haskell.org/haskellwiki/Yhc/Javascript, which is a great plan, but got abandoned (I think).
I still hope something like that will return some day (and not just for javascript, I would like to compile haskell to java bytecode or .net).

For something that's usable now, have a look at HJScript and HJavaScript.

Those are low-level libraries allowing you to generate javascript safely in haskell.
Low level because they are the bare minimum that javascript has to offer, but you can probably easily build more higher-level constructs on top of it in haskell.

If you need something more stable/complete for now, I advise you to use GWT (Google Web Toolkit). It compiles java source code into javascript, taking care of most browser differences and language oddities, and it has a very nice library to use (also if you don't use java on the server side. It can create fully independent client-side code). I know, it's not haskell, but compared to javascript, java is very safe&stable.

Mathijs




On Mon, Oct 26, 2009 at 4:04 AM, Casey Hawthorne <caseyh@istar.ca> wrote:
Is there a way to embed a Haskell interpreter/compiler in a browser.

I think this would be a safer language than JavaScript.

--
Regards,
Casey
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe