[Haskell-cafe] Re: Interesting new user perspective

Niklas Broberg niklas.broberg at gmail.com
Mon Oct 13 10:17:58 EDT 2008


>  >  *HTML> toString $ tag "b" [] [tag "i" [] [text "<>"], text "test"]
>  >  "<b><i>&lt;&gt;</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


More information about the Haskell-Cafe mailing list