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

Copyright | © Herbert Valerio Riedel 2017
License | BSD3
Maintainer | hvr@gnu.org
Stability | stable
Safe Haskell | Unsafe
Language | Haskell2010

Data.Text.Short.Unsafe

Description

Unsafe API

This module provides unsafe conversion functions

Synopsis

- fromShortByteStringUnsafe :: ShortByteString -> ShortText
- fromByteStringUnsafe :: ByteString -> ShortText

# 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.

Since: 0.1.1

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.

Since: 0.1.1