Skip to content

Commit 2089651

Browse files
committed
core: Remove deprecated functions
1 parent 76bd253 commit 2089651

File tree

6 files changed

+19
-88
lines changed

6 files changed

+19
-88
lines changed

unicode-data/Changelog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,15 @@
66
- Added `showCodePoint` to `Unicode.Char`.
77
- Added `intToDigiT` to `Unicode.Char.Numeric`.
88

9+
### Removed
10+
11+
- Removed deprecated `isLetter` and `isSpace` from `Unicode.Char.General`.
12+
Use the corresponding functions from `Unicode.Char.General.Compat` instead.
13+
- Remove deprecated `isLower` and `isUpper` from `Unicode.Char.Case`.
14+
Use the corresponding functions from `Unicode.Char.Case.Compat` instead.
15+
- Removed deprecated `Unicode.Char.Numeric.isNumber`.
16+
Use `Unicode.Char.Numeric.Compat.isNumber` instead.
17+
918
## 0.5.0 (July 2024)
1019

1120
- Fix the inlining of `Addr#` literals and reduce their size. This results in

unicode-data/lib/Unicode/Char.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ where
4646

4747
import Data.Char (chr, ord)
4848
import Unicode.Char.Case hiding (Unfold(..), Step(..))
49-
import Unicode.Char.Case.Compat hiding (isLower, isUpper)
49+
import Unicode.Char.Case.Compat
5050
import Unicode.Char.General
51-
import Unicode.Char.General.Compat hiding (isLetter, isSpace)
51+
import Unicode.Char.General.Compat
5252
import Unicode.Char.Identifiers
5353
import Unicode.Char.Numeric
5454
import Unicode.Char.Normalization

unicode-data/lib/Unicode/Char/Case.hs

Lines changed: 4 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
module Unicode.Char.Case
1717
( -- * Predicates
1818
isLowerCase
19-
, isLower
2019
, isUpperCase
21-
, isUpper
2220
-- * Case mappings
2321
-- $case
2422

@@ -57,22 +55,13 @@ import qualified Unicode.Internal.Char.SpecialCasing.UpperCaseMapping as C
5755
-- It uses the character property
5856
-- <https://www.unicode.org/reports/tr44/#Lowercase Lowercase>.
5957
--
58+
-- See: 'Unicode.Char.Case.Compat.isLower' for the legacy predicate.
59+
--
6060
-- @since 0.3.0
6161
{-# INLINE isLowerCase #-}
6262
isLowerCase :: Char -> Bool
6363
isLowerCase = P.isLowercase
6464

65-
-- | Returns 'True' for lower-case characters.
66-
--
67-
-- It uses the character property
68-
-- <https://www.unicode.org/reports/tr44/#Lowercase Lowercase>.
69-
--
70-
-- @since 0.1.0
71-
{-# INLINE isLower #-}
72-
{-# DEPRECATED isLower "Use isLowerCase instead. Note that the behavior of this function does not match base:Data.Char.isLower. See Unicode.Char.Case.Compat for behavior compatible with base:Data.Char." #-}
73-
isLower :: Char -> Bool
74-
isLower = P.isLowercase
75-
7665
-- | Returns 'True' for upper-case characters.
7766
--
7867
-- It uses the character property
@@ -82,26 +71,13 @@ isLower = P.isLowercase
8271
-- @'Unicode.Char.General.generalCategory' c ==
8372
-- 'Unicode.Char.General.TitlecaseLetter'@.
8473
--
74+
-- See: 'Unicode.Char.Case.Compat.isUpper' for the legacy predicate.
75+
--
8576
-- @since 0.3.0
8677
{-# INLINE isUpperCase #-}
8778
isUpperCase :: Char -> Bool
8879
isUpperCase = P.isUppercase
8980

90-
-- | Returns 'True' for upper-case characters.
91-
--
92-
-- It uses the character property
93-
-- <https://www.unicode.org/reports/tr44/#Uppercase Uppercase>.
94-
--
95-
-- Note: it does /not/ match title-cased letters. Those are matched using:
96-
-- @'Unicode.Char.General.generalCategory' c ==
97-
-- 'Unicode.Char.General.TitlecaseLetter'@.
98-
--
99-
-- @since 0.1.0
100-
{-# INLINE isUpper #-}
101-
{-# DEPRECATED isUpper "Use isUpperCase instead. Note that the behavior of this function does not match base:Data.Char.isUpper. See Unicode.Char.Case.Compat for behavior compatible with base:Data.Char." #-}
102-
isUpper :: Char -> Bool
103-
isUpper = P.isUppercase
104-
10581
-- $case
10682
--
10783
-- Correct case conversion rules may map one input character to two or three

unicode-data/lib/Unicode/Char/General.hs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ module Unicode.Char.General
2929
, isWhiteSpace
3030
, isNoncharacter
3131

32-
-- ** Deprecated
33-
, isLetter
34-
, isSpace
35-
3632
-- ** Re-export
3733
, isAscii
3834
, isLatin1
@@ -552,25 +548,6 @@ isNoncharacter c
552548
= ('\xFDD0' <= c && c <= '\xFDEF')
553549
|| (ord c .&. 0xFFFF) >= 0xFFFE
554550

555-
-- | Returns 'True' for alphabetic Unicode characters (lower-case, upper-case
556-
-- and title-case letters, plus letters of caseless scripts and modifiers
557-
-- letters).
558-
--
559-
-- @since 0.1.0
560-
{-# INLINE isLetter #-}
561-
{-# DEPRECATED isLetter "Use isAlphabetic instead. Note that the behavior of this function does not match base:Data.Char.isLetter. See Unicode.Char.General.Compat for behavior compatible with base:Data.Char." #-}
562-
isLetter :: Char -> Bool
563-
isLetter = P.isAlphabetic
564-
565-
-- | Returns 'True' for any whitespace characters, and the control
566-
-- characters @\\t@, @\\n@, @\\r@, @\\f@, @\\v@.
567-
--
568-
-- @since 0.1.0
569-
{-# INLINE isSpace #-}
570-
{-# DEPRECATED isSpace "Use isWhiteSpace instead. Note that the behavior of this function does not match base:Data.Char.isSpace. See Unicode.Char.General.Compat for behavior compatible with base:Data.Char." #-}
571-
isSpace :: Char -> Bool
572-
isSpace = P.isWhite_Space
573-
574551
-------------------------------------------------------------------------------
575552
-- Korean Hangul
576553
-------------------------------------------------------------------------------

unicode-data/lib/Unicode/Char/Numeric.hs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
module Unicode.Char.Numeric
1212
( -- * Predicates
1313
isNumeric
14-
, isNumber
1514

1615
-- * Numeric values
1716
, numericValue
@@ -34,35 +33,11 @@ import Data.Maybe (isJust)
3433
import Data.Ratio (denominator, numerator)
3534
import GHC.Exts (Char (..), Int (..), chr#, isTrue#, (+#), (<=#), (>=#))
3635

37-
import qualified Unicode.Char.Numeric.Compat as Compat
3836
import qualified Unicode.Internal.Char.DerivedNumericValues as V
3937

4038
-- $setup
4139
-- >>> import Data.Int (Int32, Int64)
4240

43-
-- | Selects Unicode numeric characters, including digits from various
44-
-- scripts, Roman numerals, et cetera.
45-
--
46-
-- This function returns 'True' if its argument has one of the
47-
-- following 'Unicode.Char.General.GeneralCategory's, or 'False' otherwise:
48-
--
49-
-- * 'Unicode.Char.General.DecimalNumber'
50-
-- * 'Unicode.Char.General.LetterNumber'
51-
-- * 'Unicode.Char.General.OtherNumber'
52-
--
53-
-- __Note:__ a character may have a numeric value (see 'numericValue') but return
54-
-- 'False', because 'isNumber' only tests 'Unicode.Char.General.GeneralCategory':
55-
-- some CJK characters are 'Unicode.Char.General.OtherLetter' and do have a
56-
-- numeric value. Use 'isNumeric' to cover those cases as well.
57-
--
58-
-- prop> isNumber c == Data.Char.isNumber c
59-
--
60-
-- @since 0.3.0
61-
{-# DEPRECATED isNumber "Use Unicode.Char.Numeric.Compat.isNumber instead. This function will be a synonym for isNumeric in a future release. See Unicode.Char.Numeric.Compat for behavior compatible with base:Data.Char." #-}
62-
{-# INLINE isNumber #-}
63-
isNumber :: Char -> Bool
64-
isNumber = Compat.isNumber
65-
6641
-- | Selects Unicode character with a numeric value.
6742
--
6843
-- __Note:__ a character may have a numeric value but return 'False' with

unicode-data/test/Unicode/CharSpec.hs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ import Data.Ix (Ix(..))
1212
import Data.Maybe (isJust)
1313
import qualified Unicode.Char as UChar
1414
import qualified Unicode.Char.General.Blocks as UBlocks
15-
-- [TODO] Remove the following qualified imports once isLetter and isSpace
16-
-- are removed from Unicode.Char.General
17-
import qualified Unicode.Char.General.Compat as UCharCompat
18-
-- [TODO] Remove the following qualified imports once isUpper and isLower
19-
-- are removed from Unicode.Char.Case
20-
import qualified Unicode.Char.Case.Compat as UCharCompat
2115
import qualified Unicode.Char.Numeric as UNumeric
2216
import qualified Unicode.Char.Numeric.Compat as UNumericCompat
2317
import qualified Unicode.Internal.Char.UnicodeData.GeneralCategory as UC
@@ -134,7 +128,7 @@ spec = do
134128
Char.chr UC.MaxIsLetter `shouldBe` maxCodePointBy isLetterRef
135129
UC.MaxIsLetter `shouldSatisfy` isPlane0To3
136130
it "Compare to base" do
137-
UCharCompat.isLetter `shouldBeEqualToV` Char.isLetter
131+
UChar.isLetter `shouldBeEqualToV` Char.isLetter
138132
it "isMark" do
139133
UChar.isMark `shouldBeEqualToV` Char.isMark
140134
it "isPrint" do
@@ -158,7 +152,7 @@ spec = do
158152
Char.chr UC.MaxIsSpace `shouldBe` maxCodePointBy isSpaceRef
159153
UC.MaxIsSpace `shouldSatisfy` isPlane0To3
160154
it "Compare to base" do
161-
UCharCompat.isSpace `shouldBeEqualToV` Char.isSpace
155+
UChar.isSpace `shouldBeEqualToV` Char.isSpace
162156
it "isSymbol" do
163157
UChar.isSymbol `shouldBeEqualToV` Char.isSymbol
164158
describe "Case" do
@@ -168,7 +162,7 @@ spec = do
168162
Char.chr UC.MaxIsLower `shouldBe` maxCodePointBy isLowerRef
169163
UC.MaxIsLower `shouldSatisfy` isPlane0To3
170164
it "Compare to base" do
171-
UCharCompat.isLower `shouldBeEqualToV` Char.isLower
165+
UChar.isLower `shouldBeEqualToV` Char.isLower
172166
#if MIN_VERSION_base(4,18,0)
173167
it "isLowerCase" do
174168
UChar.isLowerCase `shouldBeEqualToV` Char.isLowerCase
@@ -182,7 +176,7 @@ spec = do
182176
Char.chr UC.MaxIsUpper `shouldBe` maxCodePointBy isUpperRef
183177
UC.MaxIsUpper `shouldSatisfy` isPlane0To3
184178
it "Compare to base" do
185-
UCharCompat.isUpper `shouldBeEqualToV` Char.isUpper
179+
UChar.isUpper `shouldBeEqualToV` Char.isUpper
186180
#if MIN_VERSION_base(4,18,0)
187181
it "isUpperCase" do
188182
UChar.isUpperCase `shouldBeEqualToV` Char.isUpperCase

0 commit comments

Comments
 (0)