type-level-bytestrings-0.2.0: Tools for manipulating type-level bytes and bytestrings
Safe HaskellNone
LanguageGHC2021

Data.Type.Symbol.Utf8

Description

Type-level UTF-8 codepoint conversion.

Synopsis

Documentation

type SymbolToUtf8 (sym :: Symbol) = SymbolToUtf8' ('[] :: [Natural]) (UnconsSymbol sym) Source #

Convert a type-level symbol to UTF-8.

Each Natural in the return list is "byte-sized" (0 <= n <= 0xFF).

type CharToUtf8 (ch :: Char) = UnicodeCodePointToUtf8 (CharToNat ch) Source #

Convert a type-level character to UTF-8.

Each Natural in the return list is "byte-sized" (0 <= n <= 0xFF).

type UnicodeCodePointToUtf8 (n :: Natural) = IfNatLte n 127 '[n] (IfNatLte n 2047 (UCP2 n) (IfNatLte n 65535 (UCP3 n) (IfNatLte n 1114111 (UCP4 n) (TypeError ('Text "not a Unicode codepoint: " ':<>: 'ShowType n) :: [Natural])))) Source #

Convert a type-level Unicode code point to UTF-8

Emits a type error if you give it an invalid codepoint.