unicode-data-0.6.0: Access Unicode Character Database (UCD)

Copyright | (c) 2020 Composewell Technologies and Contributors
License | Apache-2.0
Maintainer | streamly@composewell.com
Stability | experimental
Safe Haskell | None
Language | Haskell2010

Unicode.Char.General.Compat

Description

Compatibility module for general character property related functions.

The functions of this module are drop-in replacement for those in Data.Char. They are similar but not identical to some functions in Unicode.Char.General, therefore they are placed in a separate module in order to avoid ambiguity.

Synopsis

- isAlpha :: Char -> Bool
- isAlphaNum :: Char -> Bool
- isLetter :: Char -> Bool
- isSpace :: Char -> Bool

# Documentation

isAlpha :: Char -> Bool #

Same as `isLetter`.

Since: 0.3.0

isAlphaNum :: Char -> Bool #

Selects alphabetic or numeric Unicode characters.

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

- `UppercaseLetter`
- `LowercaseLetter`
- `TitlecaseLetter`
- `ModifierLetter`
- `OtherLetter`
- `DecimalNumber`
- `LetterNumber`
- `OtherNumber`

    isAlphaNum c == Data.Char.isAlphaNum c

Note: this function is incompatible with `isAlphabetic`:

    >>> Unicode.Char.General.isAlphabetic '\x345'
    True
    >>> isAlphaNum '\x345'
    False

@since 0.6.0 moved to Compat module

Since: 0.3.0

isLetter :: Char -> Bool #

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

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

- `UppercaseLetter`
- `LowercaseLetter`
- `TitlecaseLetter`
- `ModifierLetter`
- `OtherLetter`

Note: this function is not equivalent to `isAlphabetic`. See the description of `isAlphabetic` for further details.

    isLetter c == Data.Char.isLetter c

Since: 0.3.0

isSpace :: Char -> Bool #

Selects Unicode space characters (general category `Space`), and the control characters `\t`, `\n`, `\r`, `\f`, `\v`.

Note: `isSpace` is not equivalent to `isWhiteSpace`. `isWhiteSpace` selects the same characters from `isSpace` plus the following:

- `U+0085` NEXT LINE (NEL)
- `U+2028` LINE SEPARATOR
- `U+2029` PARAGRAPH SEPARATOR

    isSpace c == Data.Char.isSpace c

Since: 0.3.0