2 % (c) The AQUA Project, Glasgow University, 1994-1999
5 \section[Char]{Module @Char@}
8 {-# OPTIONS -fno-implicit-prelude #-}
14 , isAscii, isLatin1, isControl
15 , isPrint, isSpace, isUpper
16 , isLower, isAlpha, isDigit
17 , isOctDigit, isHexDigit, isAlphaNum -- :: Char -> Bool
19 , toUpper, toLower -- :: Char -> Char
21 , digitToInt -- :: Char -> Int
22 , intToDigit -- :: Int -> Char
24 , ord -- :: Char -> Int
25 , chr -- :: Int -> Char
26 , readLitChar -- :: ReadS Char
27 , showLitChar -- :: Char -> ShowS
28 , lexLitChar -- :: ReadS String
32 -- Implementation checked wrt. Haskell 98 lib report, 1/99.
36 import PrelRead (readLitChar, lexLitChar)
37 import {-# SOURCE #-} PrelErr ( error )
42 -- Digit conversion operations
44 digitToInt :: Char -> Int
46 | isDigit c = fromEnum c - fromEnum '0'
47 | c >= 'a' && c <= 'f' = fromEnum c - fromEnum 'a' + 10
48 | c >= 'A' && c <= 'F' = fromEnum c - fromEnum 'A' + 10
49 | otherwise = error ("Char.digitToInt: not a digit " ++ show c) -- sigh