标签: haskell
在Haskell中,当且仅当x是Integral时,如何打印没有小数点的小数x?请改进我的代码:
printFrac :: (Show a, RealFrac a) => a -> IO () printFrac x = if x==fromIntegral (round x) then print (round x) else print x