Go to the first, previous, next, last section, table of contents.

The `_PackedString' type

The type `_PackedString' is built-in, i.e., no special action (other than a `-fglasgow-exts' flag) is required to use it.

The documentation here describes the built-in functions.

You may also access this code as a system library and not use the `-fglasgow-exts' flag. Just do `import PackedString', heave in your `-syslib ghc', and drop off the leading underscores which you see here.

We still may change this interface (again).

The basic type and functions which are available are:

data _PackedString

_packString      :: [Char] -> _PackedString
_packStringST    :: [Char] -> _ST s _PackedString
_packCString     :: _Addr  -> _PackedString
_packCBytes      :: Int -> _Addr -> _PackedString
_packCBytesST    :: Int -> _Addr -> _ST s _PackedString
_packBytesForC   :: [Char] -> _ByteArray Int
_packBytesForCST :: [Char] -> _ST s (_ByteArray Int)
_byteArrayToPS   :: _ByteArray Int -> _PackedString
_psToByteArray   :: _PackedString -> _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 {-or String?-}
_filterPS   :: (Char -> Bool) -> _PackedString -> _PackedString {-or String?-}
_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

_substrPS   :: _PackedString -> Int -> Int -> _PackedString
            -- pluck out a piece of a _PS
            -- start and end chars you want; both 0-origin-specified


Go to the first, previous, next, last section, table of contents.