So che puoi convertire un Stringin un numero con read:
Prelude> read "3" :: Int
3
Prelude> read "3" :: Double
3.0
Ma come afferrare la Stringrappresentazione di un Intvalore?
So che puoi convertire un Stringin un numero con read:
Prelude> read "3" :: Int
3
Prelude> read "3" :: Double
3.0
Ma come afferrare la Stringrappresentazione di un Intvalore?
Risposte:
L'opposto di readè show.
Prelude> show 3
"3"
Prelude> read $ show 3 :: Int
3