Skip to content

Commit 51b305d

Browse files
authored
Merge pull request #51 from wismill/feature/expose_unicode_version
Expose Unicode version
2 parents 5d1ff06 + 6b26486 commit 51b305d

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 the module `Unicode.Char.Case.Compat`.
78
- Added `GeneralCategory` data type and corresponding `generalCategoryAbbr`,
89
`generalCategory` functions.

lib/Unicode/Char.hs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ module Unicode.Char
3333
, module Unicode.Char.Numeric
3434
, module Unicode.Char.Normalization
3535
, module Unicode.Char.Identifiers
36+
, unicodeVersion
3637

3738
-- * Re-export
3839
, ord
@@ -41,10 +42,17 @@ module Unicode.Char
4142
where
4243

4344
import Data.Char (chr, ord)
45+
import Data.Version (Version, makeVersion)
4446
import Unicode.Char.Case
4547
import Unicode.Char.Case.Compat
4648
import Unicode.Char.General
4749
import Unicode.Char.General.Compat
4850
import Unicode.Char.Identifiers
4951
import Unicode.Char.Numeric
5052
import Unicode.Char.Normalization
53+
54+
-- | Version of Unicode standard used by @unicode-data@.
55+
--
56+
-- @since 0.3.0
57+
unicodeVersion :: Version
58+
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)