我需要使用map
函數來獲得例如便士到磅的轉換。 對不起,這個愚蠢的問題..但我是一個初學者。詮釋到浮點轉換:沒有實例爲數[Int]
del :: Int -> Float
del x = (fromIntegral x)/100
pounds :: [Int] -> [Float]
pounds = map del
,我得到這個錯誤..
*Main> pounds 45
<interactive>:90:8:
No instance for (Num [Int])
arising from the literal `45'
Possible fix: add an instance declaration for (Num [Int])
In the first argument of `pounds', namely `45'
In the expression: pounds 45
In an equation for it': it = pounds 45