
13 Oct
2008
13 Oct
'08
10:17 a.m.
*HTML> toString $ tag "b" [] [tag "i" [] [text "<>"], text "test"] "<b><i><></i>test</b>"
I'd say the big problem is that your embedded language for describing HTML is way more complex for a domain expert than
doc = renderHTML $(q "<b><i>#{v1}</i>#{v2}</b>") where v1 = "<>" v2 = "test"
How about using Haskell Server Pages[1] and get both? doc = <b><i><% v1 %></i><% v2 %></b> where v1 = "<>" v2 = "test" No more error-prone than apfelmus' embedded language (it *is* an embedded language), and no more complex to write than the SafeString example (less in fact). And a lot more enjoyable than Ruby (ok, I admit, that's not an objective statement). Cheers, /Niklas [1] http://haskell.org/haskellwiki/HSP