[Haskell-cafe] Generating valid html

oleg at okmij.org oleg at okmij.org
Wed Nov 19 08:46:29 UTC 2014

I have sent the following message to Haskell-Cafe five days ago; it
seems to have disappeared. I'm resending because HSXML answers your
second question, of ensuring complex content constraints.

I'm not sure why do you need Monad specifically? HSXML documents are
particular monoids, which is what we want from documents. Generally
speaking, all we need is a way to create primitive documents and
to compose them into bigger ones. There are many more composition
operations than monadic bind. Not everything is a monad and not
everything has to be a monad.

Old message:

Somewhat related is the HSXML library for generating valid XML and
HTML. To be precise, the library is designed to express in the type
system content model constraints such as: block-level elements like DIV
are allowed only in the block-level context; one cannot put DIV within
H1, for example. Some items may be polymorphic: for example, TITLE
appears in HEAD, it can be an attribute and it can be an element. It
can be rendered differently in each case. The same HSXML document may
be rendered as HTML or XML (or something else entirely, e.g., PDF).


More information about the Haskell-Cafe mailing list