我需要使用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