I have the following expression:
getCount :: (Num a) => a -> [a]
getCount int = foldl
processOneCount
[0,0,0,0,0,0,0,0,0,0]
(map (singleDigitCount) (map (digitToInt) (show int)))
and i get the following error:
Couldn't match expected type `a' against inferred type `Int'
`a' is a rigid type variable bound by
the type signature for `getCount'
at C:\Users\RCIX\Desktop\Haskell Code\test.hs:23:17
Expected type: [a]
Inferred type: [Int]
In the expression:
foldl
processOneCount
[0, 0, 0, 0, ....]
(map (singleDigitCount) (map (digitToInt) (show int)))
In the definition of `getCount':
getCount int
= foldl
processOneCount
[0, 0, 0, ....]
(map (singleDigitCount) (map (digitToInt) (show int)))
yet when i do a :t [0,0,0,0,0,0,0,0,0,0]
i get back [0,0,0,0,0,0,0,0,0,0] :: (Num t) => [t]
. So why can't i use it in the first expression?