[project @ 2005-03-14 15:22:51 by simonmar]
authorsimonmar <unknown>
Mon, 14 Mar 2005 15:22:51 +0000 (15:22 +0000)
committersimonmar <unknown>
Mon, 14 Mar 2005 15:22:51 +0000 (15:22 +0000)
- isDigit only returns True for ASCII digits
- Export the new predicates from Data.Char

Data/Char.hs
GHC/Unicode.hs
cbits/WCsubst.c

index 1debe79..2ec1e66 100644 (file)
@@ -23,14 +23,16 @@ module Data.Char
     -- | Unicode characters are divided into letters, numbers, marks,
     -- punctuation, symbols, separators (including spaces) and others
     -- (including control characters).
-    -- The full set of Unicode character attributes is not accessible
-    -- in this library.
     , isAscii, isLatin1, isControl, isSpace
     , isLower, isUpper,  isAlpha,   isAlphaNum, isPrint
-    , isDigit, isOctDigit, isHexDigit  -- :: Char -> Bool
+    , isDigit, isOctDigit, isHexDigit
+    , isAsciiUpper, isAsciiLower
+    , isLetter, isMark, isNumber, isPunctuation, isSymbol, isSeparator
+
+    , GeneralCategory(..), generalCategory
 
     -- * Case conversion
-    , toUpper, toLower  -- :: Char -> Char
+    , toUpper, toLower, toTitle  -- :: Char -> Char
 
     -- * Single digit characters
     , digitToInt        -- :: Char -> Int
index 8aefad5..6a4732b 100644 (file)
@@ -195,6 +195,7 @@ isAlphaNum              :: Char -> Bool
 
 -- | Selects ASCII digits, i.e. @\'0\'@..@\'9\'@.
 isDigit                 :: Char -> Bool
+isDigit c              =  c >= '0' && c <= '9'
 
 -- | Selects ASCII octal digits, i.e. @\'0\'@..@\'7\'@.
 isOctDigit              :: Char -> Bool
@@ -216,6 +217,11 @@ toUpper                 :: Char -> Char
 -- equivalent is transformed.
 toLower                 :: Char -> Char
 
+-- | Convert a letter to the corresponding title-case letter, leaving any
+-- other character unchanged.  Any Unicode letter which has a lower-case
+-- equivalent is transformed.
+toTitle                 :: Char -> Char
+
 -- -----------------------------------------------------------------------------
 -- Implementation with the supplied auto-generated Unicode character properties
 -- table (default)
@@ -225,8 +231,8 @@ toLower                 :: Char -> Char
 -- Regardless of the O/S and Library, use the functions contained in WCsubst.c
 
 type WInt = HTYPE_WINT_T
+type CInt = HTYPE_INT
 
-isDigit    c = iswdigit (fromIntegral (ord c)) /= 0
 isAlpha    c = iswalpha (fromIntegral (ord c)) /= 0
 isAlphaNum c = iswalnum (fromIntegral (ord c)) /= 0
 --isSpace    c = iswspace (fromIntegral (ord c)) /= 0
@@ -295,7 +301,6 @@ isLower c           =  c >= 'a' && c <= 'z' ||
                            c >= '\xF8' && c <= '\xFF'
 
 isAlpha c              =  isLower c || isUpper c
-isDigit c              =  c >= '0' && c <= '9'
 isAlphaNum c           =  isAlpha c || isDigit c
 
 -- Case-changing operations
index 18752b9..d63e0ea 100644 (file)
@@ -3070,7 +3070,6 @@ unipred_s(u_iswspace,GENCAT_ZS)
 unipred(u_iswupper,(GENCAT_LU|GENCAT_LT))
 unipred(u_iswlower,GENCAT_LL)
 unipred(u_iswalpha,(GENCAT_LL|GENCAT_LU|GENCAT_LT|GENCAT_LM|GENCAT_LO))
-unipred(u_iswdigit,GENCAT_ND)
 
 unipred(u_iswalnum,(GENCAT_LT|GENCAT_LU|GENCAT_LL|GENCAT_LM|GENCAT_LO|
                    GENCAT_MC|GENCAT_ME|GENCAT_MN|