[Haskell-cafe] Generating valid html

Tobias Dammers tdammers at gmail.com
Fri Nov 21 14:05:51 UTC 2014


On Wed, Nov 19, 2014 at 03:45:37PM +0100, Wojtek Narczyński wrote:
> On 19.11.2014 13:17, Tobias Dammers wrote:
> >That's pretty much what my tamper library
> >(http://hackage.haskell.org/package/tamper) is supposed to be. It's
> >pretty rough around the edges still, and nowhere near as complete as
> >Blaze itself, but it works well enough for basic HTML templating, and
> >unlike Blaze, it is implemented as a monad transformer, which means you
> >can integrate it with whatever monad stack you like. I couldn't find an
> >existing solution to this myself, which is why I rolled my own.
> Tobias,
>
>
> I'm puzzled how your library can ensure that, for example <head> has only
> one <title>, how / where are such rules enforced? Do you have a sample or
> testcase?

Ah, sorry for getting your hopes up. No, it doesn't ensure valid
parent/child combinations or anything, it just does what basic
Blaze-HTML does, but generalized to a monad transformer.

>
>
> On the practical side, wouldn't you prefer to write, for example?
>
> {-#LANGUAGE Rank2Types #-}
>
> type ElementType = (Monad m, Ord t, IsString t) => TamperT t m () ->
TamperT
> t m ()
>
> a, abbr, address, area, article, aside, audio :: ElementType
> a = tag "a"
> abbr = tag "abbr"
> address = tag "address"
> area = tagS "area"
> article = tag "article"
> aside = tag "aside"
> audio = tag "audio"

Good point; patches welcome in case I forget doing it myself ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20141121/19406986/attachment.html>


More information about the Haskell-Cafe mailing list