unicode-tricks-0.11.0.0: Functions to work with unicode blocks more convenient.
Maintainerhapytexeu+gh@gmail.com
Stabilityexperimental
PortabilityPOSIX
Safe HaskellSafe
LanguageHaskell2010

Data.Char.Tag

Description

Warning: Using tags to convey language tags is strongly discouraged by the Unicode developers.

Unicode has a tags block. This is used to make hidden annotations to specify the language of the text, this is no longer recommended. Since then this Unicode block has been repurposed as modifiers for region flag emoji. These are used for example in the flag of Scotland with "\x1f3f4\xe0067\xe0062\xe0073\xe0063\xe0074\xe007f" where the first character is the emoji of a black flag, the following two characters are tags for g, and b to present Great Brittain, then the following three characters are used to specify the region where s, c and t are used to specify Scotland and finally the stateful tag terminator to end the Emoji sequence.

Synopsis

Documentation

Check if the given item is a tag; or has a tag counterpart.

isTag Source #

Arguments

:: Char

The given Character to check.

-> Bool 

Check if the given Char is a tag.

isAsciiTag Source #

Arguments

:: Char

The given Character to check.

-> Bool

True if for the given tag, a visible ASCII character exists.

Check if the given item is a tag for a visible ASCII character.

hasTagCounterPart Source #

Arguments

:: Char

The given Character to check.

-> Bool

True if for the given Char a tag variant exists; otherwise False.

Check if the given Character has a tag counterpart. This is only the case for visible ASCII characters.

Convert from and to tags.

toTag Source #

Arguments

:: Char

The given Character to convert to a tag character.

-> Maybe Char

The corresponding tag Character wrapped in a Just if such tag character exists; otherwise Nothing.

Convert the given Char to a tag wrapped in a Just data constructor. if there is no tag for the given Char, it returns Nothing.

toTags Source #

Arguments

:: String

The given String of Characters to convert to a String of tag characters.

-> Maybe String

The string of tags wrapped in a Just data constructor; Nothing if at least one of the given Characters has no tag counterpart.

Try to convert the given string of characters, to a string of tag characters. If one of the conversions failed, Nothing is returned.

toTag' Source #

Arguments

:: Char

The given Character to convert to its corresponding tag character.

-> Char

The corresponding tag Character. If the given Character has no tag counterpart, it is unspecified what will happen.

Convert the given Character to the corresponding tag character. If the given character has no tag counterpart, it is unspecified what will happen.

toTags' Source #

Arguments

:: String

The given String of Characters to convert to tags.

-> String

A String of tag characters that correspond to the given String.

Convert the given string of Characters to a string of corresponding tag characters. If a Character has no corresponding tag Character, the behavior is unspecified.

fromTag Source #

Arguments

:: Char

The given tag that corresponds to a visible ASCII character.

-> Maybe Char

The visible ASCII character wrapped in a Just if such character exists; Nothing otherwise.

Convert the given tag Character to its visible ASCII counterpart wrapped in a Just data constructor. If there is no such counterpart, Nothing is returned.

fromTag' Source #

Arguments

:: Char

The given tag with a visible ASCII counterpart.

-> Char

The visible ASCII counterpart of the given tag.

Convert the given tag Character to its visible ASCII counterpart. If the given Character has no such counterpart, the behavior is unspecified.

fromTags Source #

Arguments

:: String

The corresponding String of tag characters, which are convert to the visible ASCII counterpart.

-> Maybe String

A String with the visible ASCII counterparts wrapped in a Just; Nothing if there is at least one character that has no such counterpart.

Convert the given string of tag Characters to the visible ASCII counterparts wrapped in a Just data constructor. If there is a Char in the given String that has no such counterpart, Nothing is returned.

fromTags' Source #

Arguments

:: String

The given String of characters to convert to their visible ASCII counterpart.

-> String

A string with the visible ASCII counterparts. The result is unspecified if at least one of the strings has no such counterpart.

Convert the given String of tags to the corresponding string of visible ASCII characters. If at least one of the given Characters has no visible ASCII counterpart, the behavior is unspecified.

Constants for two special Unicode codepoints.

languageTag Source #

Arguments

:: Char

A Character that once denoted the beginning of the language tags of a document.

A Character that specfies the beginning of the language specification of the text. Since tags should no longer be used to specify languages, this character is deprecated.

cancelTag Source #

Arguments

:: Char

A Character that specifies that the sequence of emoji modifiers has ended.

A tag Character that specifies the end of the sequence of modifiers.