text-short-0.1.1: Memory-efficient representation of Unicode text strings

Copyright© Herbert Valerio Riedel 2017
LicenseBSD3
Maintainerhvr@gnu.org
Stabilitystable
Safe HaskellUnsafe
LanguageHaskell2010

Data.Text.Short.Unsafe

Description

Unsafe API

This module provides unsafe conversion functions

Synopsis

Documentation

fromShortByteStringUnsafe :: ShortByteString -> ShortText Source #

\(\mathcal{O}(0)\) Construct ShortText from UTF-8 encoded ShortByteString

This operation has effectively no overhead, as it's currently merely a newtype-cast.

WARNING: Unlike the safe fromShortByteString conversion, this conversion is unsafe as it doesn't validate the well-formedness of the UTF-8 encoding.

fromByteStringUnsafe :: ByteString -> ShortText Source #

\(\mathcal{O}(n)\) Construct ShortText from UTF-8 encoded ByteString

This operation is \(\mathcal{O}(n)\) because the ByteString needs to be copied into an unpinned ByteArray#.

WARNING: Unlike the safe fromByteString conversion, this conversion is unsafe as it doesn't validate the well-formedness of the UTF-8 encoding.