byteslice-0.2.11.1: Slicing managed and unmanaged memory
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Bytes.Text.Utf8

Description

Convert Bytes to and from Text and ShortText.

Synopsis

Documentation

fromShortText :: ShortText -> Bytes Source #

Encode ShortText using UTF-8. Since ShortText is backed by a UTF-8 byte sequence, this does not perform a copy.

toShortText :: Bytes -> Maybe ShortText Source #

Attempt to interpret the byte sequence as UTF-8 encoded text. Returns Nothing if the bytes are not UTF-8 encoded text.