-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathChar.hsc
1320 lines (1182 loc) · 33.5 KB
/
Char.hsc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{-# LANGUAGE BangPatterns, DeriveDataTypeable, FlexibleInstances,
ForeignFunctionInterface, FunctionalDependencies, MultiParamTypeClasses #-}
-- |
-- Module : Data.Text.ICU.Char
-- Copyright : (c) 2010 Bryan O'Sullivan
--
-- License : BSD-style
-- Maintainer : [email protected]
-- Stability : experimental
-- Portability : GHC
--
-- Access to the Unicode Character Database, implemented as bindings
-- to the International Components for Unicode (ICU) libraries.
--
-- Unicode assigns each codepoint (not just assigned character) values for
-- many properties. Most are simple boolean flags, or constants from a
-- small enumerated list. For some, values are relatively more complex
-- types.
--
-- For more information see \"About the Unicode Character Database\"
-- <http://www.unicode.org/ucd/> and the ICU User Guide chapter on
-- Properties <http://icu-project.org/userguide/properties.html>.
module Data.Text.ICU.Char
(
-- * Working with character properties
-- $properties
Property
-- * Property identifier types
, BidiClass_(..)
, Block_(..)
, Bool_(..)
, Decomposition_(..)
, EastAsianWidth_(..)
, GeneralCategory_(..)
, HangulSyllableType_(..)
, JoiningGroup_(..)
, JoiningType_(..)
, NumericType_(..)
-- ** Combining class
, CanonicalCombiningClass_(..)
, LeadCanonicalCombiningClass_(..)
, TrailingCanonicalCombiningClass_(..)
-- ** Normalization checking
, NFCQuickCheck_(..)
, NFDQuickCheck_(..)
, NFKCQuickCheck_(..)
, NFKDQuickCheck_(..)
-- ** Text boundaries
, GraphemeClusterBreak_(..)
, LineBreak_(..)
, SentenceBreak_(..)
, WordBreak_(..)
, BidiPairedBracketType_(..)
-- * Property value types
, BlockCode(..)
, Direction(..)
, Decomposition(..)
, EastAsianWidth(..)
, GeneralCategory(..)
, HangulSyllableType(..)
, JoiningGroup(..)
, JoiningType(..)
, NumericType(..)
-- ** Text boundaries
, GraphemeClusterBreak(..)
, LineBreak(..)
, SentenceBreak(..)
, WordBreak(..)
, BidiPairedBracketType(..)
-- * Functions
, blockCode
, charFullName
, charName
, charFromFullName
, charFromName
, combiningClass
, direction
, property
, isMirrored
, mirror
-- ** Conversion to numbers
, digitToInt
, numericValue
) where
#include <unicode/uchar.h>
import Control.DeepSeq (NFData(..))
import Data.Char (chr, ord)
import Data.Int (Int32)
import Data.Text.ICU.Error (u_INVALID_CHAR_FOUND)
import Data.Text.ICU.Error.Internal (UErrorCode, handleOverflowError, withError)
import Data.Text.ICU.Internal (UBool, UChar32, asBool)
import Data.Text.ICU.Normalize.Internal (toNCR)
import Data.Typeable (Typeable)
import Data.Word (Word8)
import Foreign.C.String (CString, peekCStringLen, withCString)
import Foreign.C.Types (CInt(..))
import Foreign.Ptr (Ptr)
import System.IO.Unsafe (unsafePerformIO)
-- $properties
--
-- The 'property' function provides the main view onto the Unicode Character
-- Database. Because Unicode character properties have a variety of types,
-- the 'property' function is polymorphic. The type of its first argument
-- dictates the type of its result, by use of the 'Property' typeclass.
--
-- For instance, @'property' 'Alphabetic'@ returns a 'Bool', while @'property'
-- 'NFCQuickCheck'@ returns a @'Maybe' 'Bool'@.
-- | The language directional property of a character set.
data Direction =
LeftToRight
| RightToLeft
| EuropeanNumber
| EuropeanNumberSeparator
| EuropeanNumberTerminator
| ArabicNumber
| CommonNumberSeparator
| BlockSeparator
| SegmentSeparator
| WhiteSpaceNeutral
| OtherNeutral
| LeftToRightEmbedding
| LeftToRightOverride
| RightToLeftArabic
| RightToLeftEmbedding
| RightToLeftOverride
| PopDirectionalFormat
| DirNonSpacingMark
| BoundaryNeutral
| FirstStrongIsolate
| LeftToRightIsolate
| RightToLeftIsolate
| PopDirectionalIsolate
deriving (Eq, Enum, Show, Typeable)
instance NFData Direction where
rnf !_ = ()
-- | Descriptions of Unicode blocks.
data BlockCode =
NoBlock
| BasicLatin
| Latin1Supplement
| LatinExtendedA
| LatinExtendedB
| IPAExtensions
| SpacingModifierLetters
| CombiningDiacriticalMarks
| GreekAndCoptic
| Cyrillic
| Armenian
| Hebrew
| Arabic
| Syriac
| Thaana
| Devanagari
| Bengali
| Gurmukhi
| Gujarati
| Oriya
| Tamil
| Telugu
| Kannada
| Malayalam
| Sinhala
| Thai
| Lao
| Tibetan
| Myanmar
| Georgian
| HangulJamo
| Ethiopic
| Cherokee
| UnifiedCanadianAboriginalSyllabics
| Ogham
| Runic
| Khmer
| Mongolian
| LatinExtendedAdditional
| GreekExtended
| GeneralPunctuation
| SuperscriptsAndSubscripts
| CurrencySymbols
| CombiningDiacriticalMarksForSymbols
| LetterlikeSymbols
| NumberForms
| Arrows
| MathematicalOperators
| MiscellaneousTechnical
| ControlPictures
| OpticalCharacterRecognition
| EnclosedAlphanumerics
| BoxDrawing
| BlockElements
| GeometricShapes
| MiscellaneousSymbols
| Dingbats
| BraillePatterns
| CJKRadicalsSupplement
| KangxiRadicals
| IdeographicDescriptionCharacters
| CJKSymbolsAndPunctuation
| Hiragana
| Katakana
| Bopomofo
| HangulCompatibilityJamo
| Kanbun
| BopomofoExtended
| EnclosedCJKLettersAndMonths
| CJKCompatibility
| CJKUnifiedIdeographsExtensionA
| CJKUnifiedIdeographs
| YiSyllables
| YiRadicals
| HangulSyllables
| HighSurrogates
| HighPrivateUseSurrogates
| LowSurrogates
| PrivateUseArea
| CJKCompatibilityIdeographs
| AlphabeticPresentationForms
| ArabicPresentationFormsA
| CombiningHalfMarks
| CJKCompatibilityForms
| SmallFormVariants
| ArabicPresentationFormsB
| Specials
| HalfwidthAndFullwidthForms
| OldItalic
| Gothic
| Deseret
| ByzantineMusicalSymbols
| MusicalSymbols
| MathematicalAlphanumericSymbols
| CJKUnifiedIdeographsExtensionB
| CJKCompatibilityIdeographsSupplement
| Tags
| CyrillicSupplement
| Tagalog
| Hanunoo
| Buhid
| Tagbanwa
| MiscellaneousMathematicalSymbolsA
| SupplementalArrowsA
| SupplementalArrowsB
| MiscellaneousMathematicalSymbolsB
| SupplementalMathematicalOperators
| KatakanaPhoneticExtensions
| VariationSelectors
| SupplementaryPrivateUseAreaA
| SupplementaryPrivateUseAreaB
| Limbu
| TaiLe
| KhmerSymbols
| PhoneticExtensions
| MiscellaneousSymbolsAndArrows
| YijingHexagramSymbols
| LinearBSyllabary
| LinearBIdeograms
| AegeanNumbers
| Ugaritic
| Shavian
| Osmanya
| CypriotSyllabary
| TaiXuanJingSymbols
| VariationSelectorsSupplement
| AncientGreekMusicalNotation
| AncientGreekNumbers
| ArabicSupplement
| Buginese
| CJKStrokes
| CombiningDiacriticalMarksSupplement
| Coptic
| EthiopicExtended
| EthiopicSupplement
| GeorgianSupplement
| Glagolitic
| Kharoshthi
| ModifierToneLetters
| NewTaiLue
| OldPersian
| PhoneticExtensionsSupplement
| SupplementalPunctuation
| SylotiNagri
| Tifinagh
| VerticalForms
| N'Ko
| Balinese
| LatinExtendedC
| LatinExtendedD
| PhagsPa
| Phoenician
| Cuneiform
| CuneiformNumbersAndPunctuation
| CountingRodNumerals
| Sundanese
| Lepcha
| OlChiki
| CyrillicExtendedA
| Vai
| CyrillicExtendedB
| Saurashtra
| KayahLi
| Rejang
| Cham
| AncientSymbols
| PhaistosDisc
| Lycian
| Carian
| Lydian
| MahjongTiles
| DominoTiles
| Samaritan
| UnifiedCanadianAboriginalSyllabicsExtended
| TaiTham
| VedicExtensions
| Lisu
| Bamum
| CommonIndicNumberForms
| DevanagariExtended
| HangulJamoExtendedA
| Javanese
| MyanmarExtendedA
| TaiViet
| MeeteiMayek
| HangulJamoExtendedB
| ImperialAramaic
| OldSouthArabian
| Avestan
| InscriptionalParthian
| InscriptionalPahlavi
| OldTurkic
| RumiNumeralSymbols
| Kaithi
| EgyptianHieroglyphs
| EnclosedAlphanumericSupplement
| EnclosedIdeographicSupplement
| CJKUnifiedIdeographsExtensionC
| Mandaic
| Batak
| EthiopicExtendedA
| Brahmi
| BamumSupplement
| KanaSupplement
| PlayingCards
| MiscellaneousSymbolsAndPictographs
| Emoticons
| TransportAndMapSymbols
| AlchemicalSymbols
| CJKUnifiedIdeographsExtensionD
| ArabicExtendedA
| ArabicMathematicalAlphabeticSymbols
| Chakma
| MeeteiMayekExtensions
| MeroiticCursive
| MeroiticHieroglyphs
| Miao
| Sharada
| SoraSompeng
| SundaneseSupplement
| Takri
| BassaVah
| CaucasianAlbanian
| CopticEpactNumbers
| CombiningDiacriticalMarksExtended
| Duployan
| Elbasan
| GeometricShapesExtended
| Grantha
| Khojki
| Khudawadi
| LatinExtendedE
| LinearA
| Mahajani
| Manichaean
| MendeKikakui
| Modi
| Mro
| MyanmarExtendedB
| Nabataean
| OldNorthArabian
| OldPermic
| OrnamentalDingbats
| PahawhHmong
| Palmyrene
| PauCinHau
| PsalterPahlavi
| ShorthandFormatControls
| Siddham
| SinhalaArchaicNumbers
| SupplementalArrowsC
| Tirhuta
| WarangCiti
| Ahom
| AnatolianHieroglyphs
| CherokeeSupplement
| CJKUnifiedIdeographsExtensionE
| EarlyDynasticCuneiform
| Hatran
| Multani
| OldHungarian
| SupplementalSymbolsAndPictographs
| SuttonSignwriting
-- New blocks in Unicode 9.0 (ICU 58)
| Adlam
| Bhaiksuki
| CyrillicExtendedC
| GlagoliticSupplement
| IdeographicSymbolsAndPunctuation
| Marchen
| MongolianSupplement
| Newa
| Osage
| Tangut
| TangutComponents
-- New blocks in Unicode 10.0 (ICU 60)
| CjkUnifiedIdeographsExtensionF
| KanaExtendedA
| MasaramGondi
| Nushu
| Soyombo
| SyriacSupplement
| ZanabazarSquare
-- New blocks in Unicode 11.0 (ICU 62)
| ChessSymbols
| Dogra
| GeorgianExtended
| GunjalaGondi
| HanifiRohingya
| IndicSiyaqNumbers
| Makasar
| MayanNumerals
| Medefaidrin
| OldSogdian
| Sogdian
-- New blocks in Unicode 12.0 (ICU 64)
| EgyptianHieroglyphFormatControls
| Elymaic
| Nandinagari
| NyiakengPuachueHmong
| OttomanSiyaqNumbers
| SmallKanaExtension
| SymbolsAndPictographsExtendedA
| TamilSupplement
| Wancho
-- New blocks in Unicode 13.0 (ICU 66)
| Chorasmian
| CjkUnifiedIdeographsExtensionG
| DivesAkuru
| KhitanSmallScript
| LisuSupplement
| SymbolsForLegacyComputing
| TangutSupplement
| Yezidi
-- New blocks in Unicode 14.0 (ICU 70)
| ArabicExtendedB
| CyproMinoan
| EthiopicExtendedB
| KanaExtendedB
| LatinExtendedF
| LatinExtendedG
| OldUyghur
| Tangsa
| Toto
| UnifiedCanadianAboriginalSyllabicsExtendedA
| Vithkuqi
| ZnamennyMusicalNotation
-- New blocks in Unicode 15.0 (ICU 72)
| ArabicExtendedC
| CjkUnifiedIdeographsExtensionH
| CyrillicExtendedD
| DevanagariExtendedA
| KaktovikNumerals
| Kawi
| NagMundari
deriving (Eq, Enum, Bounded, Show, Typeable)
instance NFData BlockCode where
rnf !_ = ()
data Bool_ =
Alphabetic
| ASCIIHexDigit
-- ^ 0-9, A-F, a-f
| BidiControl
-- ^ Format controls which have specific functions in the Bidi Algorithm.
| BidiMirrored
-- ^ Characters that may change display in RTL text.
| Dash
-- ^ Variations of dashes.
| DefaultIgnorable
-- ^ Ignorable in most processing.
| Deprecated
-- ^ The usage of deprecated characters is strongly discouraged.
| Diacritic
-- ^ Characters that linguistically modify the meaning of another
-- character to which they apply.
| Extender
-- ^ Extend the value or shape of a preceding alphabetic character,
-- e.g. length and iteration marks.
| FullCompositionExclusion
| GraphemeBase
-- ^ For programmatic determination of grapheme cluster boundaries.
| GraphemeExtend
-- ^ For programmatic determination of grapheme cluster boundaries.
| GraphemeLink
-- ^ For programmatic determination of grapheme cluster boundaries.
| HexDigit
-- ^ Characters commonly used for hexadecimal numbers.
| Hyphen
-- ^ Dashes used to mark connections between pieces of words, plus the
-- Katakana middle dot.
| IDContinue
-- ^ Characters that can continue an identifier.
| IDStart
-- ^ Characters that can start an identifier.
| Ideographic
-- ^ CJKV ideographs.
| IDSBinaryOperator
-- ^ For programmatic determination of Ideographic Description Sequences.
| IDSTrinaryOperator
| JoinControl
-- ^ Format controls for cursive joining and ligation.
| LogicalOrderException
-- ^ Characters that do not use logical order and require special handling
-- in most processing.
| Lowercase
| Math
| NonCharacter
-- ^ Code points that are explicitly defined as illegal for the encoding
-- of characters.
| QuotationMark
| Radical
-- ^ For programmatic determination of Ideographic Description Sequences.
| SoftDotted
-- ^ Characters with a "soft dot", like i or j. An accent placed on these
-- characters causes the dot to disappear.
| TerminalPunctuation
-- ^ Punctuation characters that generally mark the end of textual units.
| UnifiedIdeograph
-- ^ For programmatic determination of Ideographic Description Sequences.
| Uppercase
| WhiteSpace
| XidContinue
-- ^ 'IDContinue' modified to allow closure under normalization forms
-- NFKC and NFKD.
| XidStart
-- ^ 'IDStart' modified to allow closure under normalization forms NFKC
-- and NFKD.
| CaseSensitive
-- ^ Either the source of a case mapping or /in/ the target of a case
-- mapping. Not the same as the general category @Cased_Letter@.
| STerm
-- ^ Sentence Terminal. Used in UAX #29: Text Boundaries
-- <http://www.unicode.org/reports/tr29/>.
| VariationSelector
-- ^ Indicates all those characters that qualify as Variation
-- Selectors. For details on the behavior of these characters, see
-- <http://unicode.org/Public/UNIDATA/StandardizedVariants.html> and 15.6
-- Variation Selectors.
| NFDInert
-- ^ ICU-specific property for characters that are inert under NFD, i.e.
-- they do not interact with adjacent characters. Used for example in
-- normalizing transforms in incremental mode to find the boundary of
-- safely normalizable text despite possible text additions.
| NFKDInert
-- ^ ICU-specific property for characters that are inert under NFKD, i.e.
-- they do not interact with adjacent characters.
| NFCInert
-- ^ ICU-specific property for characters that are inert under NFC,
-- i.e. they do not interact with adjacent characters.
| NFKCInert
-- ^ ICU-specific property for characters that are inert under NFKC,
-- i.e. they do not interact with adjacent characters.
| SegmentStarter
-- ^ ICU-specific property for characters that are starters in terms of
-- Unicode normalization and combining character sequences.
| PatternSyntax
-- ^ See UAX #31 Identifier and Pattern Syntax
-- <http://www.unicode.org/reports/tr31/>.
| PatternWhiteSpace
-- ^ See UAX #31 Identifier and Pattern Syntax
-- <http://www.unicode.org/reports/tr31/>.
| POSIXAlNum
-- ^ Alphanumeric character class.
| POSIXBlank
-- ^ Blank character class.
| POSIXGraph
-- ^ Graph character class.
| POSIXPrint
-- ^ Printable character class.
| POSIXXDigit
-- ^ Hex digit character class.
| Cased
-- ^ Cased character class. For lowercase, uppercase and titlecase characters.
| CaseIgnorable
-- ^ Used in context-sensitive case mappings.
| ChangesWhenLowercased
| ChangesWhenUppercased
| ChangesWhenTitlecased
| ChangesWhenCasefolded
| ChangesWhenCasemapped
| ChangesWhenNFKCCasefolded
| Emoji -- ^ See http://www.unicode.org/reports/tr51/#Emoji_Properties
| EmojiPresentation -- ^ See http://www.unicode.org/reports/tr51/#Emoji_Properties
| EmojiModifier -- ^ See http://www.unicode.org/reports/tr51/#Emoji_Properties
| EmojiModifierBase -- ^ See http://www.unicode.org/reports/tr51/#Emoji_Properties
| EmojiComponent -- ^ See http://www.unicode.org/reports/tr51/#Emoji_Properties
| RegionalIndicator
| PrependedConcatenationMark
| ExtendedPictographic
-- ICU 70
| BasicEmoji -- ^ See https://www.unicode.org/reports/tr51/#Emoji_Sets
| EmojiKeycapSequence -- ^ See https://www.unicode.org/reports/tr51/#Emoji_Sets
| RgiEmojiModifierSequence -- ^ See https://www.unicode.org/reports/tr51/#Emoji_Sets
| RgiEmojiFlagSequence -- ^ See https://www.unicode.org/reports/tr51/#Emoji_Sets
| RgiEmojiTagSequence -- ^ See https://www.unicode.org/reports/tr51/#Emoji_Sets
| RgiEmojiZwjSequence -- ^ See https://www.unicode.org/reports/tr51/#Emoji_Sets
| RgiEmoji -- ^ See https://www.unicode.org/reports/tr51/#Emoji_Sets
deriving (Eq, Enum, Show, Typeable)
instance NFData Bool_ where
rnf !_ = ()
class Property p v | p -> v where
fromNative :: p -> Int32 -> v
toUProperty :: p -> UProperty
data BidiClass_ = BidiClass deriving (Show, Typeable)
instance NFData BidiClass_ where
rnf !_ = ()
instance Property BidiClass_ Direction where
fromNative _ = toEnum . fromIntegral
toUProperty _ = (#const UCHAR_BIDI_CLASS)
data Block_ = Block
instance NFData Block_ where
rnf !_ = ()
instance Property Block_ BlockCode where
fromNative _ = toEnum . fromIntegral
toUProperty _ = (#const UCHAR_BLOCK)
data CanonicalCombiningClass_ = CanonicalCombiningClass deriving (Show,Typeable)
instance NFData CanonicalCombiningClass_ where
rnf !_ = ()
instance Property CanonicalCombiningClass_ Int where
fromNative _ = fromIntegral
toUProperty _ = (#const UCHAR_CANONICAL_COMBINING_CLASS)
data Decomposition_ = Decomposition deriving (Show, Typeable)
instance NFData Decomposition_ where
rnf !_ = ()
data Decomposition =
Canonical
| Compat
| Circle
| Final
| Font
| Fraction
| Initial
| Isolated
| Medial
| Narrow
| NoBreak
| Small
| Square
| Sub
| Super
| Vertical
| Wide
| Count
deriving (Eq, Enum, Show, Typeable)
instance NFData Decomposition where
rnf !_ = ()
instance Property Decomposition_ (Maybe Decomposition) where
fromNative _ = maybeEnum
toUProperty _ = (#const UCHAR_DECOMPOSITION_TYPE)
data EastAsianWidth_ = EastAsianWidth deriving (Show, Typeable)
instance NFData EastAsianWidth_ where
rnf !_ = ()
data EastAsianWidth = EANeutral
| EAAmbiguous
| EAHalf
| EAFull
| EANarrow
| EAWide
| EACount
deriving (Eq, Enum, Show, Typeable)
instance NFData EastAsianWidth where
rnf !_ = ()
instance Property EastAsianWidth_ EastAsianWidth where
fromNative _ = toEnum . fromIntegral
toUProperty _ = (#const UCHAR_EAST_ASIAN_WIDTH)
instance Property Bool_ Bool where
fromNative _ = (/=0)
toUProperty = fromIntegral . fromEnum
data GeneralCategory_ = GeneralCategory deriving (Show, Typeable)
instance NFData GeneralCategory_ where
rnf !_ = ()
data GeneralCategory =
GeneralOtherType -- ^ U_GENERAL_OTHER_TYPES is the same as U_UNASSIGNED
| UppercaseLetter
| LowercaseLetter
| TitlecaseLetter
| ModifierLetter
| OtherLetter
| NonSpacingMark
| EnclosingMark
| CombiningSpacingMark
| DecimalDigitNumber
| LetterNumber
| OtherNumber
| SpaceSeparator
| LineSeparator
| ParagraphSeparator
| ControlChar
| FormatChar
| PrivateUseChar
| Surrogate
| DashPunctuation
| StartPunctuation
| EndPunctuation
| ConnectorPunctuation
| OtherPunctuation
| MathSymbol
| CurrencySymbol
| ModifierSymbol
| OtherSymbol
| InitialPunctuation
| FinalPunctuation
deriving (Eq, Enum, Show, Typeable)
instance NFData GeneralCategory where
rnf !_ = ()
instance Property GeneralCategory_ GeneralCategory where
fromNative _ = toEnum . fromIntegral
toUProperty _ = (#const UCHAR_GENERAL_CATEGORY)
data JoiningGroup_ = JoiningGroup deriving (Show, Typeable)
instance NFData JoiningGroup_ where
rnf !_ = ()
maybeEnum :: Enum a => Int32 -> Maybe a
maybeEnum 0 = Nothing
maybeEnum n = Just $! toEnum (fromIntegral n-1)
data JoiningGroup =
Ain
| Alaph
| Alef
| Beh
| Beth
| Dal
| DalathRish
| E
| Feh
| FinalSemkath
| Gaf
| Gamal
| Hah
| HamzaOnHehGoal
| He
| Heh
| HehGoal
| Heth
| Kaf
| Kaph
| KnottedHeh
| Lam
| Lamadh
| Meem
| Mim
| Noon
| Nun
| Pe
| Qaf
| Qaph
| Reh
| ReversedPe
| Sad
| Sadhe
| Seen
| Semkath
| Shin
| SwashKaf
| SyriacWaw
| Tah
| Taw
| TehMarbuta
| Teth
| Waw
| Yeh
| YehBarree
| YehWithTail
| Yudh
| YudhHe
| Zain
| Fe
| Khaph
| Zhain
| BurushaskiYehBarree
| FarsiYeh
| Nya
| RohingyaYeh
| ManichaeanAleph
| ManichaeanAyin
| ManichaeanBeth
| ManichaeanDaleth
| ManichaeanDhamedh
| ManichaeanFive
| ManichaeanGimel
| ManichaeanHeth
| ManichaeanHundred
| ManichaeanKaph
| ManichaeanLamedh
| ManichaeanMem
| ManichaeanNun
| ManichaeanOne
| ManichaeanPe
| ManichaeanQoph
| ManichaeanResh
| ManichaeanSadhe
| ManichaeanSamekh
| ManichaeanTaw
| ManichaeanTen
| ManichaeanTeth
| ManichaeanThamedh
| ManichaeanTwenty
| ManichaeanWaw
| ManichaeanYodh
| ManichaeanZayin
| StraightWaw
deriving (Eq, Enum, Show, Typeable)
instance NFData JoiningGroup where
rnf !_ = ()
instance Property JoiningGroup_ (Maybe JoiningGroup) where
fromNative _ = maybeEnum
toUProperty _ = (#const UCHAR_JOINING_GROUP)
data JoiningType_ = JoiningType deriving (Show, Typeable)
instance NFData JoiningType_ where
rnf !_ = ()
data JoiningType =
JoinCausing
| DualJoining
| LeftJoining
| RightJoining
| Transparent
deriving (Eq, Enum, Show, Typeable)
instance NFData JoiningType where
rnf !_ = ()
instance Property JoiningType_ (Maybe JoiningType) where
fromNative _ = maybeEnum
toUProperty _ = (#const UCHAR_JOINING_TYPE)
data LineBreak_ = LineBreak deriving (Show, Typeable)
instance NFData LineBreak_ where
rnf !_ = ()
data LineBreak =
Ambiguous
| LBAlphabetic
| BreakBoth
| BreakAfter
| BreakBefore
| MandatoryBreak
| ContingentBreak
| ClosePunctuation
| CombiningMark
| CarriageReturn
| Exclamation
| Glue
| LBHyphen
| LBIdeographic
| Inseparable
| InfixNumeric
| LineFeed
| Nonstarter
| Numeric
| OpenPunctuation
| PostfixNumeric
| PrefixNumeric
| Quotation
| ComplexContext
| LBSurrogate
| Space
| BreakSymbols
| Zwspace
| NextLine
| WordJoiner
| H2
| H3
| JL
| JT
| JV
| CloseParenthesis
| ConditionalJapaneseStarter
| LBHebrewLetter
| LBRegionalIndicator
| EBase
| EModifier
| ZWJ
deriving (Eq, Enum, Show, Typeable)
instance NFData LineBreak where
rnf !_ = ()
instance Property LineBreak_ (Maybe LineBreak) where
fromNative _ = maybeEnum
toUProperty _ = (#const UCHAR_LINE_BREAK)
data NumericType_ = NumericType deriving (Show, Typeable)
instance NFData NumericType_ where
rnf !_ = ()
data NumericType = NTDecimal | NTDigit | NTNumeric
deriving (Eq, Enum, Show, Typeable)
instance NFData NumericType where
rnf !_ = ()
instance Property NumericType_ (Maybe NumericType) where
fromNative _ = maybeEnum
toUProperty _ = (#const UCHAR_NUMERIC_TYPE)
data HangulSyllableType_ = HangulSyllableType deriving (Show, Typeable)
instance NFData HangulSyllableType_ where
rnf !_ = ()
data HangulSyllableType =
LeadingJamo
| VowelJamo
| TrailingJamo
| LVSyllable
| LVTSyllable
deriving (Eq, Enum, Show, Typeable)
instance NFData HangulSyllableType where
rnf !_ = ()
instance Property HangulSyllableType_ (Maybe HangulSyllableType) where
fromNative _ = maybeEnum
toUProperty _ = (#const UCHAR_HANGUL_SYLLABLE_TYPE)
data NFCQuickCheck_ = NFCQuickCheck deriving (Show, Typeable)
data NFDQuickCheck_ = NFDQuickCheck deriving (Show, Typeable)
data NFKCQuickCheck_ = NFKCQuickCheck deriving (Show, Typeable)
data NFKDQuickCheck_ = NFKDQuickCheck deriving (Show, Typeable)
instance NFData NFCQuickCheck_ where
rnf !_ = ()