Skip to content

Commit 76dbf7f

Browse files
committed
Expose Unicode version
1 parent fc5a08b commit 76dbf7f

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## 0.3.0 (December 2021)
44

55
- Support for big-endian architectures.
6+
- Added `unicodeVersion`.
67
- Added `GeneralCategory` data type and corresponding `generalCategoryAbbr`,
78
`generalCategory` functions.
89
- Added the following functions to `Unicode.Char.General`:

lib/Unicode/Char.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ module Unicode.Char
3232
, module Unicode.Char.Numeric
3333
, module Unicode.Char.Normalization
3434
, module Unicode.Char.Identifiers
35+
, unicodeVersion
3536

3637
-- * Re-export
3738
, ord
@@ -40,9 +41,16 @@ module Unicode.Char
4041
where
4142

4243
import Data.Char (chr, ord)
44+
import Data.Version (Version, makeVersion)
4345
import Unicode.Char.Case
4446
import Unicode.Char.General
4547
import Unicode.Char.General.Compat
4648
import Unicode.Char.Identifiers
4749
import Unicode.Char.Numeric
4850
import Unicode.Char.Normalization
51+
52+
-- | Version of Unicode standard used by @unicode-data@.
53+
--
54+
-- @since 0.3.0
55+
unicodeVersion :: Version
56+
unicodeVersion = makeVersion [14, 0, 0]

ucd.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ download_files() {
5353
done
5454
}
5555

56-
# Compile and run ucd2haskell
56+
# Generate the Haskell files.
5757
run_generator() {
58+
# Compile and run ucd2haskell
5859
cabal run --flag ucd2haskell ucd2haskell -- \
5960
--input ./ucd/ \
6061
--output ./lib/ \
@@ -68,6 +69,9 @@ run_generator() {
6869
--core-prop XID_Continue \
6970
--core-prop Pattern_Syntax \
7071
--core-prop Pattern_White_Space
72+
# Update unicodeVersion in Unicode.Char
73+
VERSION_AS_LIST=$(echo "$VERSION" | sed "s/\./, /g")
74+
sed -ri "s/^(unicodeVersion = makeVersion \[)[^]]*\]/\1$VERSION_AS_LIST\]/" "lib/Unicode/Char.hs"
7175
}
7276

7377
# Print help text

0 commit comments

Comments
 (0)