Reputation: 5073
I wonder if there is any function I described below is available in Prelude. Is it? (I know about ord, but it is in Data.Char)
Prelude
ord
Data.Char
I am looking for:
f :: Char -> Int f 'a' = 0 f 'b' = 1 ....
Upvotes: 0
Views: 445
Reputation: 67507
f x = fromEnum x - fromEnum 'a'
Upvotes: 5