Marc Weber wrote: > (3) Third idea: > xmlWithInnerIO <- execXmlT $ do > xmlns "http://www.w3.org/1999/xhtml" >> lang "en-US" >> xml:lang "en-US" > head $ title $ text "minimal" > body $ do > args <- lift $ getArgs > h1 $ text "minimal" > div $ text $ "args passed to this program: " ++ (show args) > I still think that (3) would be superiour.. > Is there a way to define my own >>= and >> functions such as:
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) ] ] You use concatXml (it's concatHtml in the library) followed by a list, instead of do, for nesting. (Also, it's stringToHtml instead of text in the library.) A few more brackets, but still pretty clean. Also, you'll have pass in your args from somewhere else, in the IO monad - which is probably a better design anyway. Regards, Yitz _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
