summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonmar <unknown>2005-03-14 15:22:51 +0000
committersimonmar <unknown>2005-03-14 15:22:51 +0000
commit74348f63e26d5872fbb39a6a5796bbef30fe36e7 (patch)
treec2574a3aa55430b118da14eab8dcbd97e66cc640
parent2b179f023136bb22103856f74e44de281f31be82 (diff)
downloadhaskell-74348f63e26d5872fbb39a6a5796bbef30fe36e7.tar.gz
[project @ 2005-03-14 15:22:51 by simonmar]
- isDigit only returns True for ASCII digits - Export the new predicates from Data.Char
-rw-r--r--libraries/base/Data/Char.hs10
-rw-r--r--libraries/base/GHC/Unicode.hs9
-rw-r--r--libraries/base/cbits/WCsubst.c1
3 files changed, 13 insertions, 7 deletions
diff --git a/libraries/base/Data/Char.hs b/libraries/base/Data/Char.hs
index 1debe79ee5..2ec1e66ad4 100644
--- a/libraries/base/Data/Char.hs
+++ b/libraries/base/Data/Char.hs
@@ -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
diff --git a/libraries/base/GHC/Unicode.hs b/libraries/base/GHC/Unicode.hs
index 8aefad5f2e..6a4732b6c1 100644
--- a/libraries/base/GHC/Unicode.hs
+++ b/libraries/base/GHC/Unicode.hs
@@ -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
diff --git a/libraries/base/cbits/WCsubst.c b/libraries/base/cbits/WCsubst.c
index 18752b9663..d63e0ea013 100644
--- a/libraries/base/cbits/WCsubst.c
+++ b/libraries/base/cbits/WCsubst.c
@@ -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|