A module containing unsafe
Text operations, for very very careful
use in heavily tested code.
- inlineInterleaveST :: ST s a -> ST s a
- inlinePerformIO :: IO a -> a
- unsafeDupablePerformIO :: IO a -> a
- data Iter = Iter !Char !Int
- iter :: Text -> Int -> Iter
- iter_ :: Text -> Int -> Int
- reverseIter :: Text -> Int -> (Char, Int)
- unsafeHead :: Text -> Char
- unsafeTail :: Text -> Text
- lengthWord16 :: Text -> Int
- takeWord16 :: Int -> Text -> Text
- dropWord16 :: Int -> Text -> Text
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
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. On Hugs this is just
This version of
unsafePerformIO is more efficient
because it omits the check that the IO is only being performed by a
single thread. Hence, when you use
there is a possibility that the IO action may be performed multiple
times (on a multiprocessor), and you should therefore ensure that
it gives the same results each time.
O(1) Iterate (unsafely) one step forwards through a UTF-16 array, returning the current character and the delta to add to give the next offset to iterate at.
O(1) Iterate one step through a UTF-16 array, returning the delta to add to give the next offset to iterate at.
O(1) Iterate one step backwards through a UTF-16 array, returning the current character and the delta to add (i.e. a negative number) to give the next offset to iterate at.
O(1) Return the length of a
Text in units of
is useful for sizing a target array appropriately before using