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

Moduleunicode-data-0.4.0.1Haskell2010

Unicode.Char.Case

Case and case mapping related functions.

This module provides full predicates and mappings that are not compatible with those in Data.Char, which rely on simple properties. See Unicode.Char.Case.Compat for a drop-in replacement of the functions in Data.Char.

  • 2 types
  • 12 values

Predicates

4 declarations
valueisLower :: Char -> Bool
#

Deprecated. Use isLowerCase instead. Note that the behavior of this function does not match base:Data.Char.isLower. See Unicode.Char.Case.Compat for behavior compatible with base:Data.Char.

Returns True for lower-case characters.

It uses the character property Lowercase.

valueisUpper :: Char -> Bool
#

Deprecated. Use isUpperCase instead. Note that the behavior of this function does not match base:Data.Char.isUpper. See Unicode.Char.Case.Compat for behavior compatible with base:Data.Char.

Returns True for upper-case characters.

It uses the character property Uppercase.

Note: it does not match title-cased letters. Those are matched using: generalCategory c == TitlecaseLetter.

Case mappings

0 declarations

Correct case conversion rules may map one input character to two or three output characters. For examples, see the documentation of toCaseFoldString, toLowerString, toTitleString and toUpperString.

Note: In some languages, case conversion is a locale- and context-dependent operation. The case conversion functions in this module are not locale nor context sensitive.

Case folding mapping

Returns the full folded case mapping of a character if the character is changed, else nothing.

It uses the character property Case_Folding.

valuetoCaseFoldString :: Char -> String
#

Convert a character to full folded case if defined, else to itself.

This function is mainly useful for performing caseless (also known as case insensitive) string comparisons.

A string x is a caseless match for a string y if and only if:

foldMap toCaseFoldString x == foldMap toCaseFoldString y

The result string may have more than one character, and may differ from applying toLowerString to the input string. For instance, “ﬓ” (U+FB13 Armenian small ligature men now) is case folded to the sequence “մ” (U+0574 Armenian small letter men) followed by “ն” (U+0576 Armenian small letter now), while “µ” (U+00B5 micro sign) is case folded to “μ” (U+03BC Greek small letter mu) instead of itself.

It uses the character property Case_Folding.

Property
toCaseFoldString c == foldMap toCaseFoldString (toCaseFoldString c)

Lower case mapping

Returns the full lower case mapping of a character if the character is changed, else nothing.

It uses the character property Lowercase_Mapping.

valuetoLowerString :: Char -> String
#

Convert a character to full lower case if defined, else to itself.

The result string may have more than one character. For instance, “İ” (U+0130 Latin capital letter I with dot above) maps to the sequence: “i” (U+0069 Latin small letter I) followed by “ ̇” (U+0307 combining dot above).

It uses the character property Lowercase_Mapping.

See: toLower for simple lower case conversion.

Property
toLowerString c == foldMap toLowerString (toLowerString c)

Title case mapping

Returns the full title case mapping of a character if the character is changed, else nothing.

It uses the character property Titlecase_Mapping.

valuetoTitleString :: Char -> String
#

Convert a character to full title case if defined, else to itself.

The result string may have more than one character. For instance, “fl” (U+FB02 Latin small ligature FL) is converted to the sequence: “F” (U+0046 Latin capital letter F) followed by “l” (U+006C Latin small letter L).

It uses the character property Titlecase_Mapping.

See: toTitle for simple title case conversion.

Upper case mapping

Returns the full upper case mapping of a character if the character is changed, else nothing.

It uses the character property Uppercase_Mapping.

valuetoUpperString :: Char -> String
#

Convert a character to full upper case if defined, else to itself.

The result string may have more than one character. For instance, the German “ß” (U+00DF Eszett) maps to the two-letter sequence “SS”.

It uses the character property Uppercase_Mapping.

See: toUpper for simple upper case conversion.

Property
toUpperString c == foldMap toUpperString (toUpperString c)

Unfold

datadata Unfold a b
#

An Unfold a b is a generator of a stream of values of type b from a seed of type a.

Constructors

datadata Step s a
#

A stream is a succession of Steps.

Constructors

  • Yield !a !s

    Produces a single value and the next state of the stream.

  • Stop

    Indicates there are no more values in the stream.

Instances1Functor
  • Functor (Step s)Defined in unicode-data-0.4.0.1 · Unicode.Internal.Unfold