digitToInt- this is what already exists. He lived in a module Char, but now he lives in Data.Char, so we must import Data.Charuse it.
Prelude> import Data.Char
Prelude Data.Char> digitToInt '1'
1
You can use digitToIntfor each item in the list with map digitToInt. map :: (a->b) -> [a] -> [b]applies a function (a->b)to each element of the list as, [a], to get a list of bs, [b].
Prelude Data.Char> map digitToInt ['1', '2', '3', '4']
[1,2,3,4]
Missing accompanying binding
digitToInt , digitToInt :: Char -> Int. ,
alwaysSeven :: Char -> Int
.
The type signature for `alwaysSeven' lacks an accompanying binding
, .
alwaysSeven :: Char -> Int
alwaysSeven x = 7