Andy Gill's html library

Keean k.schupke@ic.ac.uk
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
types:

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

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-----
From: glasgow-haskell-users-admin@haskell.org
[mailto:glasgow-haskell-users-admin@haskell.org]On Behalf Of Albert Lai
Sent: 26 June 2002 05:52
To: glasgow-haskell-users@haskell.org
Subject: Re: Andy Gill's Html library


"Thomas L. Bevan" <tom@regex.com.au> 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
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users