In another question, one of the comments says, "[Data.]Text is becoming the de-facto textual implementation. String is still around for legacy reasons and for simple things, but for serious textual manipulation you should be using Text."

What is the easiest way to convert a Data.Text to an Int? read will not work because the read function always takes a String.

The best that I can come up with is:

let fortyTwo = Data.Text.pack "42"
read $ Data.Text.unpack fortyTwo :: Int

Is there a better way?

Edit
Report