[Haskell-cafe] Is it possible to "easily" connect Haskell to JavaScript/JavaFX in the browser and use a browser as a Windows GUI? :)

Anton van Straaten anton at appsolutions.com
Wed Oct 20 16:48:25 EDT 2010


caseyh at istar.ca wrote:
>>> Is it possible to "easily" connect Haskell to JavaScript/JavaFX in 
>>> the browser and use a browser as a Windows GUI? :)
...
> I meant call Haskell functions from a browser; so the browser handles 
> the GUI widgets and Haskell handles the processing. :)

It's pretty easy to get the basics going.  There are a bunch of options. 
  Start here:

http://www.haskell.org/haskellwiki/Web

For what you're asking about, I'd suggest looking at the following 
options from that page.  All of these options involve linking a web 
server library into your Haskell app, so it's self-contained and all you 
need is a browser to talk to it:

#6: Snap + custom code: Snap is simple to get started with, and is good 
if you know exactly what HTML/Javascript you need to generate and don't 
mind doing it more or less manually.  If you're looking for richer 
library support for developing HTML UIs, consider the next option.

#2: Snap + Yesod: Yesod will give you many of the framework features you 
might want for developing web UIs.  (Not sure about JavaFX though.)

#1: Happstack: an ambitious web server / framework with some fancy 
features like its own data persistence system.

One other tool worth considering if you're doing a lot of Javascript 
with Haskell is JMacro: http://www.haskell.org/haskellwiki/Jmacro

It lets you embed Javascript code directly in Haskell, and easily embed 
Haskell data into that code.

Anton



More information about the Haskell-Cafe mailing list