compact-string-0.3.1: Fast, packed and strict strings with Unicode support, based on bytestrings.

Portabilityuntested
Stabilityexperimental
Maintainertwanvl@gmail.com

Data.CompactString.Unsafe

Contents

Description

Unsafe functions on CompactStrings. All these functions can lead to crashes if not used properly.

Synopsis

Basic interface

unsafeHead :: Encoding a => CompactString a -> CharSource

A variety of head for non-empty CompactString. unsafeHead omits the check for the empty case, so there is an obligation on the programmer to provide a proof that the CompactString is non-empty.

unsafeLast :: Encoding a => CompactString a -> CharSource

A variety of last for non-empty CompactString. unsafeLast omits the check for the empty case, so there is an obligation on the programmer to provide a proof that the CompactString is non-empty.

unsafeTail :: Encoding a => CompactString a -> CompactString aSource

A variety of tail for non-empty CompactString. unsafeTail omits the check for the empty case, so there is an obligation on the programmer to provide a proof that the CompactString is non-empty.

unsafeInit :: Encoding a => CompactString a -> CompactString aSource

A variety of init for non-empty CompactString. unsafeInit omits the check for the empty case, so there is an obligation on the programmer to provide a proof that the CompactString is non-empty.

Conversion from ByteString

unsafeFromByteString :: ByteString -> CompactString aSource

Convert a ByteString to a CompactString, does not check whether the ByteString represents a valid string in the encoding a.