Skip to content

Commit 112de80

Browse files
wismilladithyaov
authored andcommitted
Updates following discussion.
1 parent 37de284 commit 112de80

File tree

4 files changed

+29
-15
lines changed

4 files changed

+29
-15
lines changed

Changelog.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,24 @@
1818

1919
These modules are compatible with `base:Data.Char`.
2020
- Re-export some functions from `Data.Char` in order to make `Unicode.Char`
21-
a drop-in replacement.
21+
a drop-in replacement in a _future_ version of this package.
2222
- Drop support for GHC 7.10.3
2323

2424
### Deprecations
2525

26-
- In `Unicode.Char.General`.
26+
- In `Unicode.Char.Case`:
2727

28-
- `isLetter`
29-
- `isSpace`
28+
- `isUpper`: use `isUpperCase` instead.
29+
- `isLower`: use `isLowerCase` instead.
3030

31-
Preserve the behavior of these functions in `isAlphabetic` and `isWhiteSpace`
32-
respectively.
31+
- In `Unicode.Char.General`:
32+
33+
- `isLetter`: use `isAlphabetic` instead.
34+
- `isSpace`: use `isWhiteSpace` instead.
35+
36+
- In `Unicode.Char`: same as hereinabove. These functions will be replaced in a
37+
_future_ release with the functions with the same names from
38+
`Unicode.Char.Case.Compat` and `Unicode.Char.General.Compat`.
3339

3440
## 0.2.0 (November 2021)
3541

lib/Unicode/Char.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ where
4343

4444
import Data.Char (chr, ord)
4545
import Data.Version (Version, makeVersion)
46-
import Unicode.Char.Case hiding (isLower, isUpper)
47-
import Unicode.Char.Case.Compat
48-
import Unicode.Char.General hiding (isLetter, isSpace)
49-
import Unicode.Char.General.Compat
46+
import Unicode.Char.Case
47+
import Unicode.Char.Case.Compat hiding (isLower, isUpper)
48+
import Unicode.Char.General
49+
import Unicode.Char.General.Compat hiding (isLetter, isSpace)
5050
import Unicode.Char.Identifiers
5151
import Unicode.Char.Numeric
5252
import Unicode.Char.Normalization

lib/Unicode/Char/General.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,9 @@ isSymbol c = case generalCategory c of
431431
OtherSymbol -> True
432432
_ -> False
433433

434-
-- | Returns 'True' for alphabetic Unicode characters.
434+
-- | Returns 'True' for alphabetic Unicode characters (lower-case, upper-case
435+
-- and title-case letters, plus letters of caseless scripts and modifiers
436+
-- letters).
435437
--
436438
-- @since 0.1.0
437439
{-# INLINE isLetter #-}

test/Unicode/CharSpec.hs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ module Unicode.CharSpec
77

88
import qualified Data.Char as Char
99
import qualified Unicode.Char as UChar
10+
-- [TODO] Remove the following qualified imports once isLetter and isSpace
11+
-- are removed from Unicode.Char.General
12+
import qualified Unicode.Char.General.Compat as UCharCompat
13+
-- [TODO] Remove the following qualified imports once isUpper and isLower
14+
-- are removed from Unicode.Char.Case
15+
import qualified Unicode.Char.Case.Compat as UCharCompat
1016
import Data.Foldable (traverse_)
1117
import Test.Hspec
1218

@@ -45,7 +51,7 @@ spec = do
4551
it "isControl" do
4652
UChar.isControl `shouldBeEqualTo` Char.isControl
4753
it "isLetter" do
48-
UChar.isLetter `shouldBeEqualTo` Char.isLetter
54+
UCharCompat.isLetter `shouldBeEqualTo` Char.isLetter
4955
it "isMark" do
5056
UChar.isMark `shouldBeEqualTo` Char.isMark
5157
it "isNumber" do
@@ -57,14 +63,14 @@ spec = do
5763
it "isSeparator" do
5864
UChar.isSeparator `shouldBeEqualTo` Char.isSeparator
5965
it "isSpace" do
60-
UChar.isSpace `shouldBeEqualTo` Char.isSpace
66+
UCharCompat.isSpace `shouldBeEqualTo` Char.isSpace
6167
it "isSymbol" do
6268
UChar.isSymbol `shouldBeEqualTo` Char.isSymbol
6369
describe' "Case" do
6470
it "isLower" do
65-
UChar.isLower `shouldBeEqualTo` Char.isLower
71+
UCharCompat.isLower `shouldBeEqualTo` Char.isLower
6672
it "isUpper" do
67-
UChar.isUpper `shouldBeEqualTo` Char.isUpper
73+
UCharCompat.isUpper `shouldBeEqualTo` Char.isUpper
6874
it "toLower" do
6975
UChar.toLower `shouldBeEqualTo` Char.toLower
7076
it "toUpper" do

0 commit comments

Comments
 (0)