HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduletext-icu-0.8.0.5Haskell98

Data.Text.ICU.Collate

String collation functions for Unicode, implemented as bindings to the International Components for Unicode (ICU) libraries.

  • 5 types
  • 10 values
  • Packagetext-icu-0.8.0.5
  • Exports15
  • LanguageHaskell98
  • LicenceBSD-3-Clause
  • SourceCollate.hsc

Unicode collation API

5 declarations
datadata Attribute
#

Constructors

  • French Bool

    Direction of secondary weights, used in French. True, results in secondary weights being considered backwards, while False treats secondary weights in the order in which they appear.

  • AlternateHandling AlternateHandling

    For handling variable elements. NonIgnorable is default.

  • CaseFirst (Maybe CaseFirst)

    Control the ordering of upper and lower case letters. Nothing (the default) orders upper and lower case letters in accordance to their tertiary weights.

  • CaseLevel Bool

    Controls whether an extra case level (positioned before the third level) is generated or not. When False (default), case level is not generated; when True, the case level is generated. Contents of the case level are affected by the value of the CaseFirst attribute. A simple way to ignore accent differences in a string is to set the strength to Primary and enable case level.

  • NormalizationMode Bool

    Controls whether the normalization check and necessary normalizations are performed. When False (default) no normalization check is performed. The correctness of the result is guaranteed only if the input data is in so-called FCD form (see users manual for more info). When True, an incremental check is performed to see whether the input data is in FCD form. If the data is not in FCD form, incremental NFD normalization is performed.

  • Strength Strength
  • HiraganaQuaternaryMode Bool

    When turned on, this attribute positions Hiragana before all non-ignorables on quaternary level. This is a sneaky way to produce JIS sort order.

  • Numeric Bool

    When enabled, this attribute generates a collation key for the numeric value of substrings of digits. This is a way to get '100' to sort after '2'.

Instances3Eq, Show, NFData
  • Eq AttributeDefined in text-icu-0.8.0.5 · Data.Text.ICU.Collate
  • Show AttributeDefined in text-icu-0.8.0.5 · Data.Text.ICU.Collate
  • NFData AttributeDefined in text-icu-0.8.0.5 · Data.Text.ICU.Collate
datadata AlternateHandling
#

Control the handling of variable weight elements.

Constructors

  • NonIgnorable

    Treat all codepoints with non-ignorable primary weights in the same way.

  • Shifted

    Cause codepoints with primary weights that are equal to or below the variable top value to be ignored on primary level and moved to the quaternary level.

Instances5Bounded, Enum, Eq, Show, NFData
datadata CaseFirst
#

Control the ordering of upper and lower case letters.

Constructors

  • UpperFirst

    Force upper case letters to sort before lower case.

  • LowerFirst

    Force lower case letters to sort before upper case.

Instances5Bounded, Enum, Eq, Show, NFData
datadata Strength
#

The strength attribute. The usual strength for most locales (except Japanese) is tertiary. Quaternary strength is useful when combined with shifted setting for alternate handling attribute and for JIS x 4061 collation, when it is used to distinguish between Katakana and Hiragana (this is achieved by setting HiraganaQuaternaryMode mode to True). Otherwise, quaternary level is affected only by the number of non ignorable codepoints in the string. Identical strength is rarely useful, as it amounts to codepoints of the NFD form of the string.

Instances5Bounded, Enum, Eq, Show, NFData
  • Bounded StrengthDefined in text-icu-0.8.0.5 · Data.Text.ICU.Collate
  • Enum StrengthDefined in text-icu-0.8.0.5 · Data.Text.ICU.Collate
  • Eq StrengthDefined in text-icu-0.8.0.5 · Data.Text.ICU.Collate
  • Show StrengthDefined in text-icu-0.8.0.5 · Data.Text.ICU.Collate
  • NFData StrengthDefined in text-icu-0.8.0.5 · Data.Text.ICU.Collate

Functions

4 declarations
valueopenRules
  1. :: Text

    A string describing the collation rules.

  2. -> Maybe Bool

    The normalization mode: One of 'Just False' (expect the text to not need normalization) 'Just True' (normalize), or Nothing (set the mode according to the rules)

  3. -> Maybe Strength

    The default collation strength; one of 'Just Primary', 'Just Secondary', 'Just Tertiary', 'Just Identical', Nothing (default strength) - can be also set in the rules.

  4. -> IO MCollator
#

Produce a Collator instance according to the rules supplied.

Utility functions