X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=GHC%2FUnicode.hs;h=6a4732b6c1986ce86f9d63144da73fdab81495a4;hb=0a41af38169035a4359c0c29bc1219af564dce64;hp=8aefad5f2eb1aaae32bced502c09f09aeba66bfa;hpb=1e076454862442966918e6b1b9095e43eab7c770;p=ghc-base.git diff --git a/GHC/Unicode.hs b/GHC/Unicode.hs index 8aefad5..6a4732b 100644 --- a/GHC/Unicode.hs +++ b/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