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

Jon Fairbairn jon.fairbairn at
Wed Dec 19 10:06:44 EST 2007

"Yitzchak Gale" <gale at> writes:

> 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...
> This is a wonderful idea, and it is clear that you have
> done some serious work here.

Thanks. It certainly felt that way... in case anyone reading
my announcement thought otherwise, the library is pretty
much complete, but there are a few design decisions that
need more heads than just my own. [I've thought of another
one: should I group together the prohibited elements
corresponding to %pre.exclusion, %formctrl (in the html dtd)
to reduce the number of type arguments?]

>> I'm announcing it here because I hope the audience is fairly
>> small but discerning
> I believe that the audience could be large. As for discerning,
> that remains to be seen. :)

:-) Well, I mean here on the libraries list. If I get some
feedback from here I'll announce it on one of the other
Haskell lists.

> What you are doing here is enforcing a DTD using
> the Haskell type system. Apart from your plans for
> HTML 4.01, perhaps a better generalization would
> be to generate typeful combinators that could
> validate at compile time for any given XML DTD.

I think that would be the job of something like HaXml or
HXT, and there are plenty of good people working on them.
To clarify, what these types enforce is something stronger
than an XML DTD, more like the SGML DTD of html (and as I
write this I am inclining myself further towards making the
document tree types fit the common subset); it enforces the
restrictions that are only expressed in prose in the
xhtml1.0 standard. You could think of it as enforcing a
schema (that the w3c didn't provide).

The reason for wanting to produce HTML4.01 is that it's
widely understood by current browsers, and serving xhtml as
html is (IMHO) rather questionable (the sets of attributes
aren't the same for one thing). I only started with xhtml
because I could use HaXml to get it off the ground.

As to other future work, I'm more inclined to try to push
typefulness out into other libraries that this one could
use, such as Network.URI.

Jón Fairbairn                                 Jon.Fairbairn at

More information about the Libraries mailing list