[Haskell] HSXML version 1.13. Overloading polyvariadic functions
oleg at pobox.com
oleg at pobox.com
Sun Feb 4 23:31:55 EST 2007
This message announces the version 1.13 of HSXML. HSXML is a library
for writing and transforming typed semi-structured data in Haskell --
in S-expression syntax, with the extensible set of `tags', and
statically enforced content model restrictions. A particular
application is writing web pages in Haskell. We obtain HTML, XHTML or
other output formats by running the Haskell web page in an appropriate
rendering monad.
The benefit of representing XML-like documents as a typed data
structure/Haskell code is static rejection of bad documents -- not
only those with undeclared tags but also those where elements appear
in wrong contexts.
The web page
http://pobox.com/~oleg/ftp/Scheme/xml.html#typed-SXML
gives further motivation and description. It points to an example of
authoring web pages in HSXML and a complex example of
context-sensitive HSXLT transformations: producing structurally
distinct HTML and XML/RSS from the same master file.
The complete source code with several examples is available at
http://pobox.com/~oleg/ftp/Haskell/HSXML.tar.gz
The new version of HSXML contains more examples, many of which have
been very kindly suggested by shelarcy. One example in particular,
quote.hs, demonstrates overloading of a polyvariadic function. That
may seem impossible: a polyvariadic function typically has the type
forall t. C t => t. How overload on t? How to overload on arguments or
the result of the function if we don't know even the number of
arguments let alone their types. It's all in the future, when the
function is applied. As it turns out, if we make preparations in the
present, we can overload the future.
More information about the Haskell
mailing list