I created the type Big Number with the following functions
type Digits = [String]
type BigNumber = Digits
scanner :: String->BigNumber
scanner a = map (:[]) a
output :: BigNumber -> String
output []=""
output a = head a ++ output(tail a)
I was trying to make a function that sums two BigNumbers like this:
somaBN :: BigNumber -> BigNumber -> BigNumber
somaBN a b = scanner (zipWith (+) (map read a) (map read b))
that is supose to run like this:
[1,2,3]+[1,2,3]=[2,4,6]
But I get the error:
• No instance for (Num Char) arising from a use of ‘+’
• In the first argument of ‘zipWith’, namely ‘(+)’
In the first argument of ‘scanner’, namely
‘(zipWith (+) (map read a) (map read b))’
In the expression: scanner (zipWith (+) (map read a) (map read b))typecheck(-Wdeferred-type-errors)
How can I fix this?