Haskell:将Int转换为String
我知道你可以转换一个String为一个数字与read : 
 Prelude> read "3" :: Int 3 Prelude> read "3" :: Double 3.0 
 但是,如何获取Int值的String表示? 
  read的对面是show 。 
 Prelude> show 3 "3" Prelude> read $ show 3 :: Int 3 
基于查克的答案的一个例子:
 myIntToStr :: Int -> String myIntToStr x | x < 3 = show x ++ " is less than three" | otherwise = "normal" 
 请注意,没有show第三行不会编译。