HORIZON HASKELLDocslts/ghc-10.0.xfc4e5982026-10-11Search names, modules, packages, or :: a typeCtrl K

GHC 10.0.0.20260917 · lts/ghc-10.0.x · fc4e598 · 2026-10-11

Moduleunicode-data-0.9.0Haskell2010

Unicode.Char.General

General character property related functions.

  • 2 types
  • 35 values

Types of Code Points

2 declarations
datadata CodePointType
#

Types of Code Points.

These classes are defined in the section 2.4 “Code Points and Characters” of the Unicode standard.

Constructors

Instances6Bounded, Enum, Eq, Ord, Show, Ix

Unicode general categories

3 declarations
datadata GeneralCategory
#

Unicode General Categories.

These classes are defined in the Unicode Character Database, part of the Unicode standard.

Note: the classes must be in the same order they are listed in the Unicode Standard, because some functions (e.g. generalCategory) rely on the Enum instance.

Constructors

Instances6Bounded, Enum, Eq, Ord, Show, Ix

The Unicode general category of the character.

This property is defined in the column 2 of the UnicodeData table.

This relies on the Enum instance of GeneralCategory, which must remain in the same order as the categories are presented in the Unicode standard.

Property
show (generalCategory c) == show (Data.Char.generalCategory c)

Character classification

10 declarations
valueisAlphabetic :: Char -> Bool
#

Returns True for alphabetic Unicode characters (lower-case, upper-case and title-case letters, plus letters of caseless scripts and modifiers letters).

Note: this function is not equivalent to isAlpha / isLetter:

valueisAlphaNum :: Char -> Bool
#

Deprecated. Use Unicode.Char.General.Compat.isAlphaNum instead.

Selects alphabetic or numeric Unicode characters.

This function returns True if its argument has one of the following GeneralCategorys, or False otherwise:

Property
isAlphaNum c == Data.Char.isAlphaNum c

Note: this function is incompatible with isAlphabetic:

Example2 expressions
isAlphabetic '\x345'TrueisAlphaNum '\x345'False
valueisControl :: Char -> Bool
#

Selects control characters, which are the non-printing characters of the Latin-1 subset of Unicode.

This function returns True if its argument has the GeneralCategory Control.

Property
isControl c == Data.Char.isControl c
valueisNoncharacter :: Char -> Bool
#

Returns True for any noncharacter.

A noncharacter is a code point that is permanently reserved for internal use (see definition D14 in the section 3.4 “Characters and Encoding” of the Unicode Standard).

Noncharacters consist of the values U+nFFFE and U+nFFFF (where n is from 0 to 10₁₆) and the values U+FDD0..U+FDEF.

Re-export

valueisAscii :: Char -> Bool
#

Selects the first 128 characters of the Unicode character set, corresponding to the ASCII character set.

valueisLatin1 :: Char -> Bool
#

Selects the first 256 characters of the Unicode character set, corresponding to the ISO 8859-1 (Latin-1) character set.

Korean Hangul Characters

0 declarations

The Hangul script used in the Korean writing system consists of individual consonant and vowel letters (jamo) that are visually combined into square display cells to form entire syllable blocks. Hangul syllables may be encoded directly as precomposed combinations of individual jamo or as decomposed sequences of conjoining jamo. Modern Hangul syllable blocks can be expressed with either two or three jamo, either in the form consonant + vowel or in the form consonant + vowel + consonant. The leading consonant is represented as L, the vowel as V and the trailing consonant as T.

The Unicode Standard contains both a large set of precomposed modern Hangul syllables and a set of conjoining Hangul jamo, which can be used to encode archaic Korean syllable blocks as well as modern Korean syllable blocks.

Hangul characters can be composed or decomposed algorithmically instead of via mappings. These APIs are used mainly for Unicode normalization of Hangul text.

Please refer to the following resources for more information:

Conjoining Jamo

Jamo L, V and T letters.

valueisJamo :: Char -> Bool
#

Determine whether a character is a jamo L, V or T character.

valuejamoNCount :: Int
#

Total count of all jamo characters.

jamoNCount = jamoVCount * jamoTCount

Jamo Leading (L)

valuejamoLIndex :: Char -> Maybe Int
#

Given a Unicode character, if it is a leading jamo, return its index in the list of leading jamo consonants, otherwise return Nothing.

Jamo Vowel (V)

valuejamoVIndex :: Char -> Maybe Int
#

Given a Unicode character, if it is a vowel jamo, return its index in the list of vowel jamo, otherwise return Nothing.

Jamo Trailing (T)

valuejamoTFirst :: Int
#

The first trailing consonant jamo.

Note that jamoTFirst does not represent a valid T, it represents a missing T i.e. LV without a T. See comments under jamoTIndex .

valuejamoTIndex :: Char -> Maybe Int
#

Given a Unicode character, if it is a trailing jamo consonant, return its index in the list of trailing jamo consonants, otherwise return Nothing.

Note that index 0 is not a valid index for a trailing consonant. Index 0 corresponds to an LV syllable, without a T. See "Hangul Syllable Decomposition" in the Conformance chapter of the Unicode standard for more details.

Hangul Syllables

Precomposed Hangul syllables.

valuehangulFirst :: Int
#

Codepoint of the first pre-composed Hangul character.

valueisHangul :: Char -> Bool
#

Determine if the given character is a precomposed Hangul syllable.

valueisHangulLV :: Char -> Bool
#

Determine if the given character is a Hangul LV syllable.

Note: this function requires a precomposed Hangul syllable but does not check it. Use isHangul to check the input character before passing it to isHangulLV.