HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Moduleunicode-data-0.4.0.1Haskell2010

Unicode.Char.General

General character property related functions.

  • 1 type
  • 35 values

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

11 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:

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
valueisLetter :: Char -> Bool
#

Deprecated. 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.

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

valueisSpace :: Char -> Bool
#

Deprecated. 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.

Returns True for any whitespace characters, and the control characters \t, \n, \r, \f, \v.

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.