Andy Gill's html library

Wed, 26 Jun 2002 11:37:42 +0100

I have an alternative HTML library if you are interested... it uses an
intermediate representation (a DOM style model) and defines the type
ShowDOM = DOM -> DOM , allowing efficent concatination using function
composition, finally a layer on top of this using the type
ShowDOM -> (a,ShowDOM), instanciating a Monad allows monadic composition of
html pages - there is also some static type checking done by creating the

newtype HtmlFragment = HtmlFragment (ShowDOM -> (a,ShowDOM))
newtype HtmlTableFragment = HtmlTableFragment (ShowDOM -> (a,ShowDOM))

this allows you to compose HTML as in the following example

attrTable [MkAttribute ("cellspacing","0")] ( do
	htmlTR (attrTD [MkAttribute ("colspan","2")] $ htmlText "Test Cell 1"))
	htmlTR ( do
		htmlTD (htmlText "Cell 2 (Left)")
		htmlTD (htmlText "Cell 3 (Right)")))

If you (or anyone) are interested let me know ... 

	Keean Schupke
	Department of Electrical & Electronic Engineering
	Imperial College - London.

-----Original Message-----
[]On Behalf Of Albert Lai
Sent: 26 June 2002 05:52
Subject: Re: Andy Gill's Html library

"Thomas L. Bevan" <> writes:

> Can someone explain the reasoning behind using 
> a function to describe a Table rather than just a list of lists?

Just my feeling, but perhaps it is essentially the same reason why
ShowS is String -> String rather than String, so that concatenation
becomes efficient?
Glasgow-haskell-users mailing list