I have a problem with ASCII in Haskell.
fromEnum :: Char -> Int
toEnum :: Int -> Char
offset :: Int
offset = fromEnum \'A\' - fromEnum \'a\'
toUpper ::
Unless you are doing this as an exercise, you should really use toUpper
from module Data.Char
.
Doing this well requires to check how uppercase is defined in Unicode -- I'd rather rely on the standard library for that :)
Also, watch out because your toUpper
is not idempotent: one might expect that toUpper 'A' == 'A'
, for instance.