Skip to content

Commit 9d56825

Browse files
committed
Deprecate functions instead of directly removing them
1 parent 9663773 commit 9d56825

File tree

3 files changed

+36
-6
lines changed

3 files changed

+36
-6
lines changed

Changelog.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,33 @@
44

55
- Support for big-endian architectures.
66
- Added `unicodeVersion`.
7-
- Added the module `Unicode.Char.Case.Compat`.
87
- Added `GeneralCategory` data type and corresponding `generalCategoryAbbr`,
98
`generalCategory` functions.
109
- Added the following functions to `Unicode.Char.General`:
1110
`isAlphabetic`, `isAlphaNum`,
1211
`isControl`, `isMark`, `isPrint`, `isPunctuation`, `isSeparator`,
1312
`isSymbol` and `isWhiteSpace`.
1413
- Added the module `Unicode.Char.Numeric`.
15-
- **Breaking change:** Changed the behavior of `isLetter` and `isSpace` to match
16-
`base`’s `Data.Char` behavior. Move these functions to the compatibility module
17-
`Unicode.Char.General.Compat`. The previous behavior is obtained using
18-
`isAlphabetic` and `isWhiteSpace` respectively.
14+
- Add compatibility modules:
15+
16+
- `Unicode.Char.General.Compat`
17+
- `Unicode.Char.Case.Compat`
18+
19+
These modules are compatible with `base:Data.Char`.
1920
- Re-export some functions from `Data.Char` in order to make `Unicode.Char`
2021
a drop-in replacement.
2122
- Drop support for GHC 7.10.3
2223

24+
### Deprecations
25+
26+
- In `Unicode.Char.General`.
27+
28+
- `isLetter`
29+
- `isSpace`
30+
31+
Preserve the behavior of these functions in `isAlphabetic` and `isWhiteSpace`
32+
respectively.
33+
2334
## 0.2.0 (November 2021)
2435

2536
* Update to [Unicode 14.0.0](https://www.unicode.org/versions/Unicode14.0.0/).

lib/Unicode/Char.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import Data.Char (chr, ord)
4545
import Data.Version (Version, makeVersion)
4646
import Unicode.Char.Case
4747
import Unicode.Char.Case.Compat
48-
import Unicode.Char.General
48+
import Unicode.Char.General hiding (isLetter, isSpace)
4949
import Unicode.Char.General.Compat
5050
import Unicode.Char.Identifiers
5151
import Unicode.Char.Numeric

lib/Unicode/Char/General.hs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ module Unicode.Char.General
2626
, isSeparator
2727
, isSymbol
2828
, isWhiteSpace
29+
, isLetter
30+
, isSpace
2931
-- ** Re-export
3032
, isAscii
3133
, isLatin1
@@ -428,6 +430,23 @@ isSymbol c = case generalCategory c of
428430
OtherSymbol -> True
429431
_ -> False
430432

433+
-- | Returns 'True' for alphabetic Unicode characters.
434+
--
435+
-- @since 0.1.0
436+
{-# INLINE isLetter #-}
437+
{-# 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." #-}
438+
isLetter :: Char -> Bool
439+
isLetter = P.isAlphabetic
440+
441+
-- | Returns 'True' for any whitespace characters, and the control
442+
-- characters @\\t@, @\\n@, @\\r@, @\\f@, @\\v@.
443+
--
444+
-- @since 0.1.0
445+
{-# INLINE isSpace #-}
446+
{-# 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." #-}
447+
isSpace :: Char -> Bool
448+
isSpace = P.isWhite_Space
449+
431450
-------------------------------------------------------------------------------
432451
-- Korean Hangul
433452
-------------------------------------------------------------------------------

0 commit comments

Comments
 (0)