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

Contents

- Combining class
- Composition
- Decomposition
  - Non-Hangul
  - Hangul

Description

Low level Unicode database functions to facilitate Unicode normalization.

For more information on Unicode normalization please refer to the following sections of the Unicode standard:

- 2 General Structure

  - 2.3 Compatibility Characters
  - 2.12 Equivalent Sequences

- 3 Conformance

  - 3.6 Combination
  - 3.7 Decomposition
  - 3.11 Normalization Forms
  - 3.12 Conjoining Jamo Behavior

- 4 Character Properties

  - 4.3 Combining Classes
- Unicode® Standard Annex #15 - Unicode Normalization Forms
- Unicode® Standard Annex #44 - Unicode Character Database

Synopsis

- isCombining :: Char -> Bool
- combiningClass :: Char -> Int
- isCombiningStarter :: Char -> Bool
- compose :: Char -> Char -> Maybe Char
- composeStarters :: Char -> Char -> Maybe Char
- data DecomposeMode
  - = Canonical
  - | Kompat
- isDecomposable :: DecomposeMode -> Char -> Bool
- decompose :: DecomposeMode -> Char -> [Char]
- decomposeHangul :: Char -> (Char, Char, Char)

# Combining class

isCombining :: Char -> Bool #

Returns `True` if a character is a combining character.

Since: 0.1.0

combiningClass :: Char -> Int #

Returns the combining class of a character.

Since: 0.1.0

isCombiningStarter :: Char -> Bool #

Return `True` if a starter character may combine with some preceding starter character.

Since: 0.1.0

# Composition

compose :: Char -> Char -> Maybe Char #

Compose a starter character (combining class 0) with a combining character (non-zero combining class). Returns the composed character if the starter combines with the combining character, returns `Nothing` otherwise.

Since: 0.1.0

composeStarters :: Char -> Char -> Maybe Char #

Compose a starter character with another starter character. Returns the composed character if the two starters combine, returns `Nothing` otherwise.

Since: 0.1.0

# Decomposition

## Non-Hangul

data DecomposeMode #

Whether we are decomposing in canonical or compatibility mode.

Since: 0.1.0

Constructors

Canonical |
Kompat |

isDecomposable :: DecomposeMode -> Char -> Bool #

Given a non-Hangul character determine if the character is decomposable. Note that in case compatibility decompositions a character may decompose into a single compatibility character.

Since: 0.1.0

decompose :: DecomposeMode -> Char -> [Char] #

Decompose a non-Hangul character into its canonical or compatibility decompositions. Note that the resulting characters may further decompose.

Since: 0.1.0

## Hangul

decomposeHangul :: Char -> (Char, Char, Char) #

Decompose a Hangul syllable into its corresponding Jamo characters.

Since: 0.1.0