> There is also the combinator approach of Text.Html, which > gives you a syntax similar to (3) but without abusing "do": > > (rootElt ! [xmlns "http://www.w3.org/1999/xhtml", > lang "en-US" >> xml:lang "en-US"]) $ concatXml > [head $ title $ text "minimal" > ,body $ concatXml > [h1 $ text "minimal" > ,div $ text $ "args passed to this program: " ++ (show args) > ] > ]
Keep in mind that my library tries to do real DTD type checking. This means that body, h1, div all have different types. So they can't easily be put into a list. And yes: I care about each character I have to type less :-) About IO (). IO was just a poor man example to show that you can nest arbitrary monads. Have a look at the WASH library to see in which wonderful ways this can be used.. One working snippet from the testXHTML.hs sample file provided by the lib: #include "vxmldos.h" tDo $ runHtmlDoc $ vdo head $ title $ text "text" body $ vdo script $ X.type "text/javascript" >> text "document.writeln('hi');" h2 $ text "That's a headline, hello and how do you do?" -- br e eg a <br/> is not allowed here div $ vdo onclick "alert('clicked');" styleA "color:#F79" text "text within the div" div e return "That's nice, isn't it?" vxmldos.h defines a vdo cpp macro which expands to let .... ; in $ do where ... rebinds >>=, >>, lift to make this work (in with ghc head) The library can now cope with fancy dts such as (a*)* etc as well If you still find bugs let me know. The more interesting part starts now: figuring out how do build a nice HTML library on top of this all. Sincerly Marc Weber _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe