views:

257

answers:

1

I know you can convert a String to an number with read like so:

Prelude> read "3" :: Int

3

Prelude> read "3" :: Double

3.0

But how do you grab the string representation of an Int value?

+10  A: 

The opposite of read is show.

Prelude> show 3
"3"

Prelude> read $ show 3 :: Int
3
Chuck
Thanks man! I can't believe I couldn't find that with a googling.
Legatou
@Lega: You may find this useful: http://www.haskell.org/hoogle/?hoogle=Int+-%3E+String.
KennyTM