basement-0.0.16: Foundation scrap box of array & string

Safe Haskell | None
Language | Haskell2010

Basement.Types.CharUTF8

Synopsis

- newtype CharUTF8 = CharUTF8 Word32
- encodeCharUTF8 :: Char -> CharUTF8
- decodeCharUTF8 :: CharUTF8 -> Char

# Documentation

newtype CharUTF8 #

Represent an already encoded UTF8 Char where the the lowest 8 bits is the start of the sequence. If this contains a multi bytes sequence then each higher 8 bits are filled with the remaining sequence 8 bits per 8 bits.

For example: `A` => U+0041 => 41 => 0x00000041 '€ => U+20AC => E2 82 AC => 0x00AC82E2 `𐍈` => U+10348 => F0 90 8D 88 => 0x888D90F0

Constructors

CharUTF8 Word32 |

encodeCharUTF8 :: Char -> CharUTF8 #

Encode a Char into a CharUTF8

decodeCharUTF8 :: CharUTF8 -> Char #

decode a CharUTF8 into a Char

If the value inside a CharUTF8 is not properly encoded, this will result in violation of the Char invariants