
Hallo, Ghci and Template Haskell show that it is possible to compile and load a module into a running program. Is there a user interface to do that? Would one be possible? Would that make a Haskell analog of Yaws (yaws.hyber.org) possible? For those who don't know Yaws: It is a web server written in Erlang that can compile and load Erlang code embedded in HTML files to produce dynamic pages. I have played with it a bit, and it seems useful to me, but I would prefer Haskell over Erlang. Greetings, Carsten -- Carsten Schultz (2:40, 33:47), FB Mathematik, FU Berlin http://www.math.fu-berlin.de/~cschultz/ PGP/GPG key on the pgp.net key servers, fingerprint on my home page.

Carsten Schultz writes:
a web server written in Erlang that can compile [...] code embedded in HTML files to produce dynamic pages
IMHO it should be possible to add a "mod_runhugs" module to Apache, which implements exactly that except that it doesn't require any compilation of code at all. As far as I know, Hugs does already have a server mode where code can be sent via IPC for execution, doesn't it? Something like this would certainly be useful, and if it's based on Apache, many people could use without any trouble. Peter

A mod_haskell (using hugs) has been done here: http://losser.st-lab.cs.uu.nl/mod_haskell/ But, think of the advantages of a type-safe web-server, utilising GHC's light weight threads... Regards, Keean Schupke. -----Original Message----- From: glasgow-haskell-users-admin@haskell.org [mailto:glasgow-haskell-users-admin@haskell.org]On Behalf Of Peter Simons Sent: 11 June 2003 18:01 To: glasgow-haskell-users@haskell.org Subject: Re: Dynamic Compilation Carsten Schultz writes:
a web server written in Erlang that can compile [...] code embedded in HTML files to produce dynamic pages
IMHO it should be possible to add a "mod_runhugs" module to Apache, which implements exactly that except that it doesn't require any compilation of code at all. As far as I know, Hugs does already have a server mode where code can be sent via IPC for execution, doesn't it? Something like this would certainly be useful, and if it's based on Apache, many people could use without any trouble. Peter _______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Keean writes:
Interesting!
But, think of the advantages of a type-safe web-server, utilising GHC's light weight threads...
Well, yes, but the problem is that web server today must provide tons of things to be suitable for production use. Authentication, CGI, even FastCGI come to my mind, etc., etc. I don't think something like Apache can be re-built from scratch very easily, so it's good that Haskell support for it is available. Peter

Whilst I Agree with you about Apache being widely useful, most websites fall into the category database backend, dynamic content in the middle and HTTP infront. Apache is a waste of disc space and memory, if all you want is Haskell Servlets (Think Java Servlets and Tomcat - a large number of major projects are done on tomcat which is a server written in Java, completely stand alone from Apache). Further to this HTTP is quite a simple protocol, and its implementation in Haskell quite easy - there is really no need for a complete implementation of the standard - you only really need put and get... When using servlets there is no need for CGI or FastCGI, the server is written in Haskell, the Servlets are written in Haskell, you use the ghci-linker to load up the pages - although for high demand services it is better to compile the pages into the server for better speed. A record is used to parse the request to the servlet. The setup we use - with real paying customers - is an implementation of HTTP in haskell - Authentication is provided by a plug-in, and like most sites uses on-page login/password boxes, the server provides session management, so the Servlet simply has to deal with page generation and parsing user-feedback. A database backend using ODBC means we can change database without major code rewrites. Everything is in Haskell (apart from the DB) and this setup will do 90% of the things you would ever want a dynamic web site to do... (The other 10% does not justify code bloat in the server - for those 10% use different tools) Regards, Keean Schupke... Peter Simons wrote:
Keean writes:
Interesting!
But, think of the advantages of a type-safe web-server, utilising GHC's light weight threads...
Well, yes, but the problem is that web server today must provide tons of things to be suitable for production use. Authentication, CGI, even FastCGI come to my mind, etc., etc. I don't think something like Apache can be re-built from scratch very easily, so it's good that Haskell support for it is available.
Peter
_______________________________________________ Glasgow-haskell-users mailing list Glasgow-haskell-users@haskell.org http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

We are using a web server written in Haskell in a production environment... It only serves dynamic pages - it is a bit like Tomcat for Haskell... It uses the ghci linker interface to load object files... but does not compile automatically. I think it sould be possible to embed ghc into an application, although I haven't looked at the interface. Regards, Keean Schupke. Carsten Schultz wrote:
Hallo,
Ghci and Template Haskell show that it is possible to compile and load a module into a running program. Is there a user interface to do that? Would one be possible? Would that make a Haskell analog of Yaws (yaws.hyber.org) possible?
For those who don't know Yaws: It is a web server written in Erlang that can compile and load Erlang code embedded in HTML files to produce dynamic pages. I have played with it a bit, and it seems useful to me, but I would prefer Haskell over Erlang.
Greetings,
Carsten

| Ghci and Template Haskell show that it is possible to | compile and load a module into a running program. Is | there a user interface to do that? Would one be | possible? Would that make a Haskell analog of Yaws | (yaws.hyber.org) possible? | | For those who don't know Yaws: It is a web server | written in Erlang that can compile and load Erlang | code embedded in HTML files to produce dynamic pages. | I have played with it a bit, and it seems useful to | me, but I would prefer Haskell over Erlang. A student here at Chalmers, made a project rather like that: http://www.dum.chalmers.se/~marvin/hws-wp/ /K

ons 2003-06-11 klockan 20.04 skrev Koen Claessen:
| Ghci and Template Haskell show that it is possible to | compile and load a module into a running program. Is | there a user interface to do that? Would one be | possible? Would that make a Haskell analog of Yaws | (yaws.hyber.org) possible? | | For those who don't know Yaws: It is a web server | written in Erlang that can compile and load Erlang | code embedded in HTML files to produce dynamic pages. | I have played with it a bit, and it seems useful to | me, but I would prefer Haskell over Erlang.
A student here at Chalmers, made a project rather like that:
Thanks for the advertising. ;) Unfortunately, that server is broken. I've put up a (hopefully complete) copy on http://www.mdstud.chalmers.se/~md9ms/hws-wp/ /Martin -- Martin Sjögren sjogren@debian.org -- marvin@dum.chalmers.se GPG key: http://www.mdstud.chalmers.se/~md9ms/gpg.html let hello = "hello" : hello in putStr (unlines hello)

ons 2003-06-11 klockan 20.56 skrev Martin Sjögren:
ons 2003-06-11 klockan 20.04 skrev Koen Claessen:
| Ghci and Template Haskell show that it is possible to | compile and load a module into a running program. Is | there a user interface to do that? Would one be | possible? Would that make a Haskell analog of Yaws | (yaws.hyber.org) possible? | | For those who don't know Yaws: It is a web server | written in Erlang that can compile and load Erlang | code embedded in HTML files to produce dynamic pages. | I have played with it a bit, and it seems useful to | me, but I would prefer Haskell over Erlang.
A student here at Chalmers, made a project rather like that:
Thanks for the advertising. ;) Unfortunately, that server is broken. I've put up a (hopefully complete) copy on
Wonderful. Since it seems they've managed to break that server right after I put the stuff up, I've (yet again) put the stuff on another server: http://www.strakt.com/~martin/hws-wp/ Let's hope this one doesn't break. Sigh. /Martin -- Martin Sjögren martin@strakt.com ICQ : 41245059 Phone: +46 (0)31 7710870 Cell: +46 (0)739 169191 GPG key: http://www.strakt.com/~martin/gpg.html
participants (7)
-
Carsten Schultz
-
Keean
-
Keean Schupke
-
Koen Claessen
-
Martin Sjögren
-
Martin Sjögren
-
Peter Simons