packedstring-0.1.0.0: (Deprecated) Packed Strings.Source codeContentsIndex
Data.PackedString
Portabilityportable
Stabilityexperimental
Maintainerlibraries@haskell.org
Contents
The PackedString type
Converting to and from PackedStrings
I/O with PackedStrings
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 Chars.
show/hide Instances
Converting to and from PackedStrings
packString :: String -> PackedStringSource
Convert a String into a PackedString
unpackPS :: PackedString -> StringSource
Convert a PackedString into a String
I/O with PackedStrings
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 PackedStringSource

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 :: PackedStringSource
The nilPS value is the empty string.
consPS :: Char -> PackedString -> PackedStringSource
The consPS function prepends the given character to the given string.
headPS :: PackedString -> CharSource
The headPS function returns the first element of a PackedString or throws an error if the string is empty.
tailPS :: PackedString -> PackedStringSource
The tailPS function returns the tail of a PackedString or throws an error if the string is empty.
nullPS :: PackedString -> BoolSource
The nullPS function returns True iff the argument is null.
appendPS :: PackedString -> PackedString -> PackedStringSource
The appendPS function appends the second string onto the first.
lengthPS :: PackedString -> IntSource
The lengthPS function returns the length of the input list. Analogous to length.
indexPS :: PackedString -> Int -> CharSource
The indexPS function returns the character in the string at the given position.
mapPS :: (Char -> Char) -> PackedString -> PackedStringSource
The mapPS function applies a function to each character in the string.
filterPS :: (Char -> Bool) -> PackedString -> PackedStringSource
The filterPS function filters out the appropriate substring.
reversePS :: PackedString -> PackedStringSource
The reversePS function reverses the string.
concatPS :: [PackedString] -> PackedStringSource
The concatPS function concatenates a list of PackedStrings.
elemPS :: Char -> PackedString -> BoolSource
The elemPS function returns True iff the given element is in the string.
substrPS :: PackedString -> Int -> Int -> PackedStringSource
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 -> PackedStringSource
The takePS function takes the first n characters of a PackedString.
dropPS :: Int -> PackedString -> PackedStringSource
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 -> aSource
The foldlPS function behaves like foldl on PackedStrings.
foldrPS :: (Char -> a -> a) -> a -> PackedString -> aSource
The foldrPS function behaves like foldr on PackedStrings.
takeWhilePS :: (Char -> Bool) -> PackedString -> PackedStringSource
The takeWhilePS function is analogous to the takeWhile function.
dropWhilePS :: (Char -> Bool) -> PackedString -> PackedStringSource
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] -> PackedStringSource
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] -> PackedStringSource
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] -> PackedStringSource
The joinPS function takes a PackedString and a list of PackedStrings and concatenates the list after interspersing the first argument between each element of the list.
Produced by Haddock version 0.9