Haskell Core Libraries (base package)ParentContentsIndex
Data.PackedString
Portability portable
Stability experimental
Maintainer libraries@haskell.org
Contents
The PackedString type
Converting to and from PackedStrings
I/O with PackedStrings
List-like manipulation functions
Description
An efficient implementation of strings.
Synopsis
data PackedString
packString :: String -> PackedString
unpackPS :: PackedString -> String
hPutPS :: Handle -> PackedString -> IO ()
hGetPS :: Handle -> Int -> IO PackedString
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
mapPS :: (Char -> Char) -> PackedString -> PackedString
filterPS :: (Char -> Bool) -> PackedString -> PackedString
reversePS :: PackedString -> PackedString
concatPS :: [PackedString] -> PackedString
elemPS :: Char -> PackedString -> Bool
substrPS :: PackedString -> Int -> Int -> PackedString
takePS :: Int -> PackedString -> PackedString
dropPS :: Int -> PackedString -> PackedString
splitAtPS :: Int -> PackedString -> (PackedString, PackedString)
foldlPS :: (a -> Char -> a) -> a -> PackedString -> a
foldrPS :: (Char -> a -> a) -> a -> PackedString -> a
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]
splitPS :: Char -> PackedString -> [PackedString]
splitWithPS :: (Char -> Bool) -> PackedString -> [PackedString]
The PackedString type
data PackedString
A space-efficient representation of a String, which supports various efficient operations. A PackedString contains full Unicode Chars.
Instances
Eq PackedString
Ord PackedString
Show PackedString
Typeable PackedString
Converting to and from PackedStrings
packString :: String -> PackedString
Convert a String into a PackedString
unpackPS :: PackedString -> String
Convert a PackedString into a String
I/O with PackedStrings
hPutPS :: Handle -> PackedString -> IO ()

Outputs a PackedString to the specified Handle.

NOTE: the representation of the PackedString in the file is assumed to be in the ISO-8859-1 encoding. In other words, only the least signficant byte is taken from each character in the PackedString.

hGetPS :: Handle -> Int -> IO PackedString

Read a PackedString directly from the specified Handle. This is far more efficient than reading the characters into a String and then using packString.

NOTE: as with hPutPS, the string representation in the file is assumed to be ISO-8859-1.

List-like manipulation 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
mapPS :: (Char -> Char) -> PackedString -> PackedString
filterPS :: (Char -> Bool) -> PackedString -> PackedString
reversePS :: PackedString -> PackedString
concatPS :: [PackedString] -> PackedString
elemPS :: Char -> PackedString -> Bool
substrPS :: PackedString -> Int -> Int -> PackedString
takePS :: Int -> PackedString -> PackedString
dropPS :: Int -> PackedString -> PackedString
splitAtPS :: Int -> PackedString -> (PackedString, PackedString)
foldlPS :: (a -> Char -> a) -> a -> PackedString -> a
foldrPS :: (Char -> a -> a) -> a -> PackedString -> a
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]
splitPS :: Char -> PackedString -> [PackedString]
splitWithPS :: (Char -> Bool) -> PackedString -> [PackedString]
Produced by Haddock version 0.3