A compact representation of Unicode strings.
A ShortText value is a sequence of Unicode scalar values, as defined in
§3.9, definition D76 of the Unicode 5.2 standard;
This means that a ShortText is a list of (scalar) Unicode code-points (i.e. code-points in the range [U+00 .. U+D7FF] ∪ [U+E000 .. U+10FFFF]).
This type relates to Text as ShortByteString relates to ByteString by providing a more compact type. Please consult the documentation of Data.ByteString.Short for more information.
Currently, a boxed unshared Text has a memory footprint of 6 words (i.e. 48 bytes on 64-bit systems) plus 1, 2, 3 or 4 bytes per code-point for text-2 (due to the internal UTF-8 representation) or 2 or 4 bytes per code-point for text-1 (due to the internal UTF-16 representation). Each Text value which can share its payload with another Text requires only 4 words additionally. Unlike ByteString, Text use unpinned memory.
In comparison, the footprint of a boxed ShortText is only 4 words (i.e. 32 bytes on 64-bit systems) plus 1, 2, 3, or 4 bytes per code-point (due to the internal UTF-8 representation).
It can be shown that for realistic data UTF-16, which is used by text-1, has a space overhead of 50% over UTF-8.
NOTE: The Typeable instance isn't defined for GHC 7.8 (and older) prior to text-short-0.1.3
Instances15IsList, Eq, Data, Ord, Read, Show, …
IsList ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalNote: Surrogate pairs (
[U+D800 .. U+DFFF]) character literals are replaced by U+FFFD.Eq ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalData ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalOrd ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalRead ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalShow ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalIsString ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalSemigroup ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalMonoid ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalPrintfArg ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalNFData ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalBinary ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalHashable ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalLift ShortTextDefined in text-short-0.1.6 · Data.Text.Short.InternalSince 0.1.3
type Item ShortText = CharDefined in text-short-0.1.6 · Data.Text.Short.Internal