text-2.1.1: An efficient packed Unicode text type.
Copyright(c) 2009 2010 2011 Bryan O'Sullivan
LicenseBSD-style
Maintainerbos@serpentine.com
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Data.Text.Unsafe

Description

A module containing unsafe Text operations, for very very careful use in heavily tested code.

Synopsis

Documentation

inlineInterleaveST :: ST s a -> ST s a Source #

Allow an ST computation to be deferred lazily. When passed an action of type ST s a, the action will only be performed when the value of a is demanded.

This function is identical to the normal unsafeInterleaveST, but is inlined and hence faster.

Note: This operation is highly unsafe, as it can introduce externally visible non-determinism into an ST action.

inlinePerformIO :: IO a -> a Source #

Just like unsafePerformIO, but we inline it. Big performance gains as it exposes lots of things to further inlining. Very unsafe. In particular, you should do no memory allocation inside an inlinePerformIO block.

data Iter Source #

Constructors

Iter !Char !Int 

Instances

Instances details
Show Iter Source # 
Instance details

Defined in Data.Text.Unsafe

Methods

showsPrec :: Int -> Iter -> ShowS #

show :: Iter -> String #

showList :: [Iter] -> ShowS #

iter :: Text -> Int -> Iter Source #

O(1) Iterate (unsafely) one step forwards through a UTF-8 array, returning the current character and the delta to add to give the next offset to iterate at.

iterArray :: Array -> Int -> Iter Source #

Since: text-2.0

iter_ :: Text -> Int -> Int Source #

O(1) Iterate one step through a UTF-8 array, returning the delta to add to give the next offset to iterate at.

reverseIter :: Text -> Int -> Iter Source #

O(1) Iterate one step backwards through a UTF-8 array, returning the current character and the delta to add (i.e. a negative number) to give the next offset to iterate at.

reverseIterArray :: Array -> Int -> Iter Source #

Since: text-2.0

reverseIter_ :: Text -> Int -> Int Source #

O(1) Iterate one step backwards through a UTF-8 array, returning the delta to add (i.e. a negative number) to give the next offset to iterate at.

Since: text-1.1.1.0

unsafeHead :: Text -> Char Source #

O(1) A variant of head for non-empty Text. unsafeHead omits the check for the empty case, so there is an obligation on the programmer to provide a proof that the Text is non-empty.

unsafeTail :: Text -> Text Source #

O(1) A variant of tail for non-empty Text. unsafeTail omits the check for the empty case, so there is an obligation on the programmer to provide a proof that the Text is non-empty.

lengthWord8 :: Text -> Int Source #

O(1) Return the length of a Text in units of Word8. This is useful for sizing a target array appropriately before using unsafeCopyToPtr.

Since: text-2.0

takeWord8 :: Int -> Text -> Text Source #

O(1) Unchecked take of k Word8s from the front of a Text.

Since: text-2.0

dropWord8 :: Int -> Text -> Text Source #

O(1) Unchecked drop of k Word8s from the front of a Text.

Since: text-2.0