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?
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?
The opposite of read
is show
.
Prelude> show 3
"3"
Prelude> read $ show 3 :: Int
3