[Haskell-cafe] Re: Interesting new user perspective

Ryan Ingram ryani.spam at gmail.com
Mon Oct 13 09:30:55 EDT 2008


Normally I agree with you, apfelmus, but here at least I have to differ!

On Mon, Oct 13, 2008 at 11:50 AM, apfelmus <apfelmus at quantentunnel.de> wrote:
>  *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"

which, while somewhat error-prone in the HTML string itself, is much
more likely to get used than an embedded language.  One thing that
"ideal in theory" solutions seem to miss out on a lot is usability;
SafeString seemed to strike a great balance there, which is why I
think it has been brought up as a great example of solving this
problem in the real world.

There's a reason why Ruby is taking off despite its complete lack of
safety; writing code using it is genuinely enjoyable and Rails solves
a lot of problems elegantly.  I wouldn't want to use it for a big
project; I have performance and reliability concerns, but attempts to
"ruby-ify" bits of Haskell where safety can be validated via a small
amount of inspection are welcome!

  -- ryan


More information about the Haskell-Cafe mailing list