The basic type and functions available are:
data PackedString -- abstract packString :: [Char] -> PackedString packStringST :: [Char] -> ST s PackedString packCBytesST :: Int -> Addr -> ST s PackedString packBytesForCST :: [Char] -> ST s (ByteArray Int) byteArrayToPS :: ByteArray Int -> PackedString unsafeByteArrayToPS :: ByteArray a -> Int -> PackedString psToByteArray :: PackedString -> ByteArray Int psToByteArrayST :: PackedString -> ST s (ByteArray Int) unpackPS :: PackedString -> [Char] |
We also provide a wad of list-manipulation-like functions:
nilPS :: PackedString consPS :: Char -> PackedString -> PackedString headPS :: PackedString -> Char tailPS :: PackedString -> PackedString nullPS :: PackedString -> Bool appendPS :: PackedString -> PackedString -> PackedString lengthPS :: PackedString -> Int indexPS :: PackedString -> Int -> Char -- 0-origin indexing into the string mapPS :: (Char -> Char) -> PackedString -> PackedString filterPS :: (Char -> Bool) -> PackedString -> PackedString foldlPS :: (a -> Char -> a) -> a -> PackedString -> a foldrPS :: (Char -> a -> a) -> a -> PackedString -> a takePS :: Int -> PackedString -> PackedString dropPS :: Int -> PackedString -> PackedString splitAtPS :: Int -> PackedString -> (PackedString, PackedString) takeWhilePS :: (Char -> Bool) -> PackedString -> PackedString dropWhilePS :: (Char -> Bool) -> PackedString -> PackedString spanPS :: (Char -> Bool) -> PackedString -> (PackedString, PackedString) breakPS :: (Char -> Bool) -> PackedString -> (PackedString, PackedString) linesPS :: PackedString -> [PackedString] wordsPS :: PackedString -> [PackedString] reversePS :: PackedString -> PackedString concatPS :: [PackedString] -> PackedString elemPS :: Char -> PackedString -> Bool -- Perl-style split&join splitPS :: Char -> PackedString -> [PackedString] splitWithPS :: (Char -> Bool) -> PackedString -> [PackedString] joinPS :: PackedString -> [PackedString] -> PackedString substrPS :: PackedString -> Int -> Int -> PackedString -- pluck out a piece of a PackedString -- start and end chars you want; both 0-origin-specified |