| packedstring-0.1.0.0: (Deprecated) Packed Strings. | Source code | Contents | Index
Data.PackedString |
Portability | portable
Stability | experimental
Maintainer | libraries@haskell.org
Contents
The `PackedString` type Converting to and from `PackedString`s I/O with `PackedString`s List-like manipulation functions
Description
This API is deprecated. You might be able to use Data.ByteString or Data.ByteString.Char8 from the bytestring package, provided you don't need full Unicode support. The long term aim is to provide a Unicode layer on Data.ByteString, and then to provide a replacement for this Data.PackedString API based on that.
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]
unlinesPS :: [PackedString] -> PackedString
wordsPS :: PackedString -> [PackedString]
unwordsPS :: [PackedString] -> PackedString
splitPS :: Char -> PackedString -> [PackedString]
splitWithPS :: (Char -> Bool) -> PackedString -> [PackedString]
joinPS :: PackedString -> [PackedString] -> PackedString
The `PackedString` type
data PackedString | Source
A space-efficient representation of a `String`, which supports various efficient operations. A `PackedString` contains full Unicode `Char`s.
Instances
Data PackedString
Eq PackedString
Ord PackedString
Show PackedString
Typeable PackedString
Converting to and from `PackedString`s
packString :: String -> PackedString | Source
Convert a `String` into a `PackedString`
unpackPS :: PackedString -> String | Source
Convert a `PackedString` into a `String`
I/O with `PackedString`s
hPutPS :: Handle -> PackedString -> IO () | Source
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 significant byte is taken from each character in the `PackedString`.
hGetPS :: Handle -> Int -> IO PackedString | Source
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 | Source
The `nilPS` value is the empty string.
consPS :: Char -> PackedString -> PackedString | Source
The `consPS` function prepends the given character to the given string.
headPS :: PackedString -> Char | Source
The `headPS` function returns the first element of a `PackedString` or throws an error if the string is empty.
tailPS :: PackedString -> PackedString | Source
The `tailPS` function returns the tail of a `PackedString` or throws an error if the string is empty.
nullPS :: PackedString -> Bool | Source
The `nullPS` function returns True iff the argument is null.
appendPS :: PackedString -> PackedString -> PackedString | Source
The `appendPS` function appends the second string onto the first.
lengthPS :: PackedString -> Int | Source
The `lengthPS` function returns the length of the input list. Analogous to `length`.
indexPS :: PackedString -> Int -> Char | Source
The `indexPS` function returns the character in the string at the given position.
mapPS :: (Char -> Char) -> PackedString -> PackedString | Source
The `mapPS` function applies a function to each character in the string.
filterPS :: (Char -> Bool) -> PackedString -> PackedString | Source
The `filterPS` function filters out the appropriate substring.
reversePS :: PackedString -> PackedString | Source
The `reversePS` function reverses the string.
concatPS :: [PackedString] -> PackedString | Source
The `concatPS` function concatenates a list of `PackedString`s.
elemPS :: Char -> PackedString -> Bool | Source
The `elemPS` function returns True iff the given element is in the string.
substrPS :: PackedString -> Int -> Int -> PackedString | Source
The `substrPS` function takes a `PackedString` and two indices and returns the substring of the input string between (and including) these indices.
takePS :: Int -> PackedString -> PackedString | Source
The `takePS` function takes the first `n` characters of a `PackedString`.
dropPS :: Int -> PackedString -> PackedString | Source
The `dropPS` function drops the first `n` characters of a `PackedString`.
splitAtPS :: Int -> PackedString -> (PackedString, PackedString) | Source
The `splitWithPS` function splits a `PackedString` at a given index.
foldlPS :: (a -> Char -> a) -> a -> PackedString -> a | Source
The `foldlPS` function behaves like `foldl` on `PackedString`s.
foldrPS :: (Char -> a -> a) -> a -> PackedString -> a | Source
The `foldrPS` function behaves like `foldr` on `PackedString`s.
takeWhilePS :: (Char -> Bool) -> PackedString -> PackedString | Source
The `takeWhilePS` function is analogous to the `takeWhile` function.
dropWhilePS :: (Char -> Bool) -> PackedString -> PackedString | Source
The `dropWhilePS` function is analogous to the `dropWhile` function.
spanPS :: (Char -> Bool) -> PackedString -> (PackedString, PackedString) | Source
The `spanPS` function returns a pair containing the result of running both `takeWhilePS` and `dropWhilePS`.
breakPS :: (Char -> Bool) -> PackedString -> (PackedString, PackedString) | Source
The `breakPS` function breaks a string at the first position which satisfies the predicate.
linesPS :: PackedString -> [PackedString] | Source
The `linesPS` function splits the input on line-breaks.
unlinesPS :: [PackedString] -> PackedString | Source
The `unlinesPS` function concatenates the input list after interspersing newlines.
wordsPS :: PackedString -> [PackedString] | Source
The `wordsPS` function is analogous to the `words` function.
unwordsPS :: [PackedString] -> PackedString | Source
The `unwordsPS` function is analogous to the `unwords` function.
splitPS :: Char -> PackedString -> [PackedString] | Source
The `splitPS` function splits the input string on each occurrence of the given `Char`.
splitWithPS :: (Char -> Bool) -> PackedString -> [PackedString] | Source
The `splitWithPS` function takes a character predicate and splits the input string at each character which satisfies the predicate.
joinPS :: PackedString -> [PackedString] -> PackedString | Source
The `joinPS` function takes a `PackedString` and a list of `PackedString`s and concatenates the list after interspersing the first argument between each element of the list.
Produced by Haddock version 0.9