title: Converting Data.Text to Int in Haskell
body: <p>In <a href="https://stackoverflow.com/q/7357775/96233">another question</a>, one of the comments says, "<code>[Data.]Text</code> is becoming the de-facto textual implementation. <code>String</code> is still around for legacy reasons and for simple things, but for serious textual manipulation you should be using <code>Text</code>."</p>
  
  <p>What is the easiest way to convert a <code>Data.Text</code> to an <code>Int</code>? <code>read</code> will not work because the <code>read</code> function always takes a <code>String</code>.</p>
  
  <p>The best that I can come up with is:</p>
  
  <pre><code>let fortyTwo = Data.Text.pack "42"
  read $ Data.Text.unpack fortyTwo :: Int
  </code></pre>
  
  <p>Is there a better way?</p>