Announcement: Typeful [x]html combinators -- pre-release 0

Jon Fairbairn jon.fairbairn at
Tue Jan 8 09:43:08 EST 2008

Tomasz Zielonka <tomasz.zielonka at> writes:

> On Tue, Dec 18, 2007 at 05:38:47PM +0000, Jon Fairbairn wrote:
>> ... or,  "whoops! I've writtten another html combinator library."
>> History: I was surprised to find that all the Haskell html
>> generating stuff I've tried allowed one to construct invalid
>> HTML.
> Did you take a look at Peter Thiemann's WASH/HTML?

I did.

> It contains a monadic combinator library that checks
> proper nesting of HTML tags at compile time. The library
> also has an unchecked version,

It's possible that I only tried the unchecked version: I
just thought of an invalid example, read what documentation
I could find and generated some invalid html. However,
Thiemann's thesis says

   The current library implements neither inclusions nor

So I hope I might be forgiven if I overlooked a difference
between the distribution and the thesis! Does the checked
version now enforce appendix B and prevent <a> appearing
anywhere within <a> and so on?

>> I'm announcing it here because I hope the audience is fairly
>> small but discerning, and I'm announcing it at all because
>> I've run out of steam for the moment. This is the first code
>> above the size of a nonce-programme that I've written since
>> I got ill years ago, so don't go too hard on me!
> I hope you won't consider my response hard ;-)

No; and if WASH /can/ now enforce all the restrictions but
isn't generally used that way, I think that's a pity (and
making it easier to find how to do this would be a big

> Perhaps you could borrow some ideas from Peter's code, or vice versa.

It turns out that the mechanism I've used to enforce the
restrictions is almost the same as the one he mentions in
the thesis as being too awkward, except that I don't in fact
need 98 type parameters, just fourteen... and I disagree
with his statement that moving to xhtml means that
implementing the restrictions is unnecesary -- W3C says that
the informal description is the normative definition, not
the DTD.

Another difference is that I haven't used any non-Haskell 98
constructs other than using Template Haskell to generate
class declarations and instances (were one so inclined, one
could get ghc to output the splices and [clean them up by
hand to] produce an entirely H98 version).

Jón Fairbairn                                 Jon.Fairbairn at

More information about the Libraries mailing list