[Haskell-cafe] JavaScript in a browser as a Windows GUI?

Jeremy Shaw jeremy at n-heptane.com
Fri Oct 22 14:01:24 EDT 2010

On Fri, Oct 22, 2010 at 12:05 PM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
>  On 21/10/2010 07:00 PM, Jeremy Shaw wrote:
>> But, you are correct that happstack does not currently have support
>> for running CGI executables. I imagine that you could write a CGI
>> handler (with out modifying the core code) in a few hours (maybe
>> less). Mostly just a matter of turning the values in the Request type
>> into a environment variables, and calling the executable?
> And writing a HTTP server is "mostly" a matter of parsing the request
> headers and constructing some response headers. However, this turns out to
> be significantly less easy to do properly than you'd first imagine. ;-)

True. Though I am basing my assumption on the fact that we have code
which goes the opposite way (allows happstack to run as a CGI
process), and those bindings are pretty short (less than 100 lines)
and simple looking.

>> That said, I am not sure why you want CGI.
> Because my hired web server runs Apache?
> Sure, if I'm only doing stuff on the local machine, I can use any kind of
> server/application linkage I like, because I can use any server I want. But
> if I ever decide to actually put this stuff on the web, for real, it'll have
> to be plain CGI. (Or maybe FastCGI is supported, I'm not actually sure...)
> That being the case, I might as well develop it as CGI to start with.

happstack-server has FastCGI support. Plain-old CGI support is no
great challenge either. Your web application is basically just a ,
ServerPart Response, value. Typically you would run that using

simpleHTTP :: (ToMessage a) => Conf -> ServerPart a -> IO ()

but you can just as easily run it as CGI using:

serverPartToCGI :: ToMessage a => ServerPart a -> CGI CGIResult

(from the happstack-fastcgi package).

- jeremy

More information about the Haskell-Cafe mailing list