title: How to concatenate strings and variables so that quotes in the variables are escaped?
body: <p>I am using <code>readJSON</code> which, in case of error, yields <code>Left err</code>. Sometimes this error (a string) contains quotation marks, e. g. <code>ReferenceError: "JSON" is not defined.</code> I need to return this error wrapped in a JSON string, sort of like</p>
  
  <pre><code>Left err -&gt; "{ \"error\" : \"The error is: " ++ (show err) ++ "\" }"
  </code></pre>
  
  <p>(the <code>show</code> is needed because we are in a fail monad.)</p>
  
  <p>But when <code>err</code> has quotation marks like the example above, this rips the JSON apart. How to get this working?</p>
  
  <p>(In PSCI, <code>show</code> seems to do a good job of escaping things, e. g. <code>show "\"foo\""</code> yields a fireworks of <code>\</code>. But inside a function as above, not?)</p>