
Hello List, I propose to change the functions digitToInt and intToDigit in Data.Char to digitToInt :: Char -> Int digitToInt c | isDigit c = ord c - ord '0' | c >= 'a' && c <= 'z' = ord c - ord 'a' + 10 | c >= 'A' && c <= 'Z' = ord c - ord 'A' + 10 | otherwise = error ("Char.digitToInt: not a digit " ++ show c) intToDigit :: Int -> Char intToDigit i | i >= 0 && i <= 9 = toEnum (fromEnum '0' + i) | i >= 10 && i <= 35 = toEnum (fromEnum 'a' + i - 10) | otherwise = error "Char.intToDigit: not a digit" (and equivalently for the Ghc specialized version in Data.Show) Right now the functions only work for c <= 'f' and i <= 15, i.e. only up to hexadecimal. But I can think of no reason why that should be the case. There is the problem of compatibility with the Haskell98/2010 report. But since this proposed change only reduces the number of cases that are errors, I think that is not a big concern. Discussion period: 2 weeks, deadline July 13. Twan