Wed, 29 Nov 2000 17:46:20 +0100 (MET)
I just send this message to share some Haskell code with
you. I hope it might be useful to some people. (Maybe even
to the haskell.org crowd!)
Recently I experimented a little bit with an easy way of
writing CGI scripts that generate HTML in Haskell.
I know many people have done this already, but I was
inspired by the paper "Haskell Server Pages" by Erik Meijer
et al., which uses an HTML datatype where one can also do IO
inside. This makes it a lot more convenient to write CGI
scripts I think.
The idea is to have an HTML datatype of the following kind:
type Html = [HtmlEl]
= Text String
| Tag String [(String,String)] Html
| Action (IO Html)
I wrote a very modest CGI library making use of this
datatype, and also providing some other useful functions for
writing CGI scripts (such as locked variables). I also
implemented some CGI scripts of course.
One script is a script that "shows" a Haskell module, using
syntax highlighting. One can also click on imported modules
and see their definitions.
To see the Haskell CGI library displyed by this CGI script,
go to the following link:
(I used it in my course, so there is some extra junk there.)
You can click on the bottom of the page, and look at the
implementation of the "show-haskell" script.
Koen Claessen http://www.cs.chalmers.se/~koen
phone:+46-31-772 5424 mailto:email@example.com
Chalmers University of Technology, Gothenburg, Sweden