Portability | untested |
---|---|

Stability | experimental |

Maintainer | twanvl@gmail.com |

Unsafe functions on `CompactString`

s.
All these functions can lead to crashes if not used properly.

- unsafeHead :: Encoding a => CompactString a -> Char
- unsafeLast :: Encoding a => CompactString a -> Char
- unsafeTail :: Encoding a => CompactString a -> CompactString a
- unsafeInit :: Encoding a => CompactString a -> CompactString a
- unsafeFromByteString :: ByteString -> CompactString a

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