File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -66,42 +66,46 @@ type Char = Char -- NOTE: The compiler provides the real implementation.
6666-- CLASSIFICATION
6767
6868
69- {- | Detect upper case Unicode characters.
69+ {- | Detect upper case ASCII characters.
7070
7171 isUpper 'A' == True
7272 isUpper 'B' == True
7373 ...
7474 isUpper 'Z' == True
75-
76- isUpper 'Σ' == True
7775
7876 isUpper '0' == False
7977 isUpper 'a' == False
8078 isUpper '-' == False
79+ isUpper 'Σ' == False
8180-}
8281isUpper : Char -> Bool
8382isUpper char =
84- ( char == Char . toUpper char)
85- && ( char /= Char . toLower char)
83+ let
84+ code =
85+ toCode char
86+ in
87+ code <= 0x5A && 0x41 <= code
8688
8789
88- {- | Detect lower case Unicode characters.
90+ {- | Detect lower case ASCII characters.
8991
9092 isLower 'a' == True
9193 isLower 'b' == True
9294 ...
9395 isLower 'z' == True
94-
95- isLower 'π' == True
9696
9797 isLower '0' == False
9898 isLower 'A' == False
9999 isLower '-' == False
100+ isLower 'π' == False
100101-}
101102isLower : Char -> Bool
102103isLower char =
103- ( char == Char . toLower char)
104- && ( char /= Char . toUpper char)
104+ let
105+ code =
106+ toCode char
107+ in
108+ 0x61 <= code && code <= 0x7A
105109
106110
107111{- | Detect upper case and lower case ASCII characters.
You can’t perform that action at this time.
0 commit comments