I am trying to convert a string (of numbers) into individual digits. There are multiple ways to solve this, one being to map digitToInt "1234"
I was trying a similar approach but instead of using digitToInt, I was trying to use the read::Char->Int function. However I am getting compilation error when I use the above, as in:
map (read::Char->Int) ['1','2']
gives me the following error given below. I am not sure what is wrong here, I am trying to map a function which takes Char over a list of Char, what am I missing?
Please do not tell me of alternate approach as I understand there are several other ways to do this. Just want to understand what is happening here.
Couldn't match type ‘Char’ with ‘[Char]’
Expected type: Char -> Int
Actual type: String -> Int
• In the first argument of ‘map’, namely ‘(read :: Char -> Int)’