diff --git a/Data/ByteString.hs b/Data/ByteString.hs index 73ccea5f3..0a7d4359a 100644 --- a/Data/ByteString.hs +++ b/Data/ByteString.hs @@ -41,172 +41,172 @@ module Data.ByteString ( -- * The @ByteString@ type - ByteString, -- abstract, instances: Eq, Ord, Show, Read, Data, Typeable, Monoid + ByteString, -- * Introducing and eliminating 'ByteString's - empty, -- :: ByteString - singleton, -- :: Word8 -> ByteString - pack, -- :: [Word8] -> ByteString - unpack, -- :: ByteString -> [Word8] - fromStrict, -- :: ByteString -> Lazy.ByteString - toStrict, -- :: Lazy.ByteString -> ByteString + empty, + singleton, + pack, + unpack, + fromStrict, + toStrict, -- * Basic interface - cons, -- :: Word8 -> ByteString -> ByteString - snoc, -- :: ByteString -> Word8 -> ByteString - append, -- :: ByteString -> ByteString -> ByteString - head, -- :: ByteString -> Word8 - uncons, -- :: ByteString -> Maybe (Word8, ByteString) - unsnoc, -- :: ByteString -> Maybe (ByteString, Word8) - last, -- :: ByteString -> Word8 - tail, -- :: ByteString -> ByteString - init, -- :: ByteString -> ByteString - null, -- :: ByteString -> Bool - length, -- :: ByteString -> Int + cons, + snoc, + append, + head, + uncons, + unsnoc, + last, + tail, + init, + null, + length, -- * Transforming ByteStrings - map, -- :: (Word8 -> Word8) -> ByteString -> ByteString - reverse, -- :: ByteString -> ByteString - intersperse, -- :: Word8 -> ByteString -> ByteString - intercalate, -- :: ByteString -> [ByteString] -> ByteString - transpose, -- :: [ByteString] -> [ByteString] + map, + reverse, + intersperse, + intercalate, + transpose, -- * Reducing 'ByteString's (folds) - foldl, -- :: (a -> Word8 -> a) -> a -> ByteString -> a - foldl', -- :: (a -> Word8 -> a) -> a -> ByteString -> a - foldl1, -- :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8 - foldl1', -- :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8 + foldl, + foldl', + foldl1, + foldl1', - foldr, -- :: (Word8 -> a -> a) -> a -> ByteString -> a - foldr', -- :: (Word8 -> a -> a) -> a -> ByteString -> a - foldr1, -- :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8 - foldr1', -- :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8 + foldr, + foldr', + foldr1, + foldr1', -- ** Special folds - concat, -- :: [ByteString] -> ByteString - concatMap, -- :: (Word8 -> ByteString) -> ByteString -> ByteString - any, -- :: (Word8 -> Bool) -> ByteString -> Bool - all, -- :: (Word8 -> Bool) -> ByteString -> Bool - maximum, -- :: ByteString -> Word8 - minimum, -- :: ByteString -> Word8 + concat, + concatMap, + any, + all, + maximum, + minimum, -- * Building ByteStrings -- ** Scans - scanl, -- :: (Word8 -> Word8 -> Word8) -> Word8 -> ByteString -> ByteString - scanl1, -- :: (Word8 -> Word8 -> Word8) -> ByteString -> ByteString - scanr, -- :: (Word8 -> Word8 -> Word8) -> Word8 -> ByteString -> ByteString - scanr1, -- :: (Word8 -> Word8 -> Word8) -> ByteString -> ByteString + scanl, + scanl1, + scanr, + scanr1, -- ** Accumulating maps - mapAccumL, -- :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString) - mapAccumR, -- :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString) + mapAccumL, + mapAccumR, -- ** Generating and unfolding ByteStrings - replicate, -- :: Int -> Word8 -> ByteString - unfoldr, -- :: (a -> Maybe (Word8, a)) -> a -> ByteString - unfoldrN, -- :: Int -> (a -> Maybe (Word8, a)) -> a -> (ByteString, Maybe a) + replicate, + unfoldr, + unfoldrN, -- * Substrings -- ** Breaking strings - take, -- :: Int -> ByteString -> ByteString - takeEnd, -- :: Int -> ByteString -> ByteString - drop, -- :: Int -> ByteString -> ByteString - dropEnd, -- :: Int -> ByteString -> ByteString - splitAt, -- :: Int -> ByteString -> (ByteString, ByteString) - takeWhile, -- :: (Word8 -> Bool) -> ByteString -> ByteString - takeWhileEnd, -- :: (Word8 -> Bool) -> ByteString -> ByteString - dropWhile, -- :: (Word8 -> Bool) -> ByteString -> ByteString - dropWhileEnd, -- :: (Word8 -> Bool) -> ByteString -> ByteString - span, -- :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString) - spanEnd, -- :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString) - break, -- :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString) - breakEnd, -- :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString) - group, -- :: ByteString -> [ByteString] - groupBy, -- :: (Word8 -> Word8 -> Bool) -> ByteString -> [ByteString] - inits, -- :: ByteString -> [ByteString] - tails, -- :: ByteString -> [ByteString] - stripPrefix, -- :: ByteString -> ByteString -> Maybe ByteString - stripSuffix, -- :: ByteString -> ByteString -> Maybe ByteString + take, + takeEnd, + drop, + dropEnd, + splitAt, + takeWhile, + takeWhileEnd, + dropWhile, + dropWhileEnd, + span, + spanEnd, + break, + breakEnd, + group, + groupBy, + inits, + tails, + stripPrefix, + stripSuffix, -- ** Breaking into many substrings - split, -- :: Word8 -> ByteString -> [ByteString] - splitWith, -- :: (Word8 -> Bool) -> ByteString -> [ByteString] + split, + splitWith, -- * Predicates - isPrefixOf, -- :: ByteString -> ByteString -> Bool - isSuffixOf, -- :: ByteString -> ByteString -> Bool - isInfixOf, -- :: ByteString -> ByteString -> Bool + isPrefixOf, + isSuffixOf, + isInfixOf, -- ** Search for arbitrary substrings - breakSubstring, -- :: ByteString -> ByteString -> (ByteString,ByteString) + breakSubstring, -- * Searching ByteStrings -- ** Searching by equality - elem, -- :: Word8 -> ByteString -> Bool - notElem, -- :: Word8 -> ByteString -> Bool + elem, + notElem, -- ** Searching with a predicate - find, -- :: (Word8 -> Bool) -> ByteString -> Maybe Word8 - filter, -- :: (Word8 -> Bool) -> ByteString -> ByteString - partition, -- :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString) + find, + filter, + partition, -- * Indexing ByteStrings - index, -- :: ByteString -> Int -> Word8 - indexMaybe, -- :: ByteString -> Int -> Maybe Word8 - (!?), -- :: ByteString -> Int -> Maybe Word8 - elemIndex, -- :: Word8 -> ByteString -> Maybe Int - elemIndices, -- :: Word8 -> ByteString -> [Int] - elemIndexEnd, -- :: Word8 -> ByteString -> Maybe Int - findIndex, -- :: (Word8 -> Bool) -> ByteString -> Maybe Int - findIndices, -- :: (Word8 -> Bool) -> ByteString -> [Int] - findIndexEnd, -- :: (Word8 -> Bool) -> ByteString -> Maybe Int - count, -- :: Word8 -> ByteString -> Int + index, + indexMaybe, + (!?), + elemIndex, + elemIndices, + elemIndexEnd, + findIndex, + findIndices, + findIndexEnd, + count, -- * Zipping and unzipping ByteStrings - zip, -- :: ByteString -> ByteString -> [(Word8,Word8)] - zipWith, -- :: (Word8 -> Word8 -> c) -> ByteString -> ByteString -> [c] - packZipWith, -- :: (Word8 -> Word8 -> Word8) -> ByteString -> ByteString -> ByteString - unzip, -- :: [(Word8,Word8)] -> (ByteString,ByteString) + zip, + zipWith, + packZipWith, + unzip, -- * Ordered ByteStrings - sort, -- :: ByteString -> ByteString + sort, -- * Low level conversions -- ** Copying ByteStrings - copy, -- :: ByteString -> ByteString + copy, -- ** Packing 'CString's and pointers - packCString, -- :: CString -> IO ByteString - packCStringLen, -- :: CStringLen -> IO ByteString + packCString, + packCStringLen, -- ** Using ByteStrings as 'CString's - useAsCString, -- :: ByteString -> (CString -> IO a) -> IO a - useAsCStringLen, -- :: ByteString -> (CStringLen -> IO a) -> IO a + useAsCString, + useAsCStringLen, -- * I\/O with 'ByteString's -- ** Standard input and output - getLine, -- :: IO ByteString - getContents, -- :: IO ByteString - putStr, -- :: ByteString -> IO () - interact, -- :: (ByteString -> ByteString) -> IO () + getLine, + getContents, + putStr, + interact, -- ** Files - readFile, -- :: FilePath -> IO ByteString - writeFile, -- :: FilePath -> ByteString -> IO () - appendFile, -- :: FilePath -> ByteString -> IO () + readFile, + writeFile, + appendFile, -- ** I\/O with Handles - hGetLine, -- :: Handle -> IO ByteString - hGetContents, -- :: Handle -> IO ByteString - hGet, -- :: Handle -> Int -> IO ByteString - hGetSome, -- :: Handle -> Int -> IO ByteString - hGetNonBlocking, -- :: Handle -> Int -> IO ByteString - hPut, -- :: Handle -> ByteString -> IO () - hPutNonBlocking, -- :: Handle -> ByteString -> IO ByteString - hPutStr, -- :: Handle -> ByteString -> IO () + hGetLine, + hGetContents, + hGet, + hGetSome, + hGetNonBlocking, + hPut, + hPutNonBlocking, + hPutStr, ) where import qualified Prelude as P diff --git a/Data/ByteString/Char8.hs b/Data/ByteString/Char8.hs index d31335b41..9e1bd71bc 100644 --- a/Data/ByteString/Char8.hs +++ b/Data/ByteString/Char8.hs @@ -43,162 +43,162 @@ module Data.ByteString.Char8 ( -- * The @ByteString@ type - ByteString, -- abstract, instances: Eq, Ord, Show, Read, Data, Typeable, Monoid + ByteString, -- * Introducing and eliminating 'ByteString's - empty, -- :: ByteString - singleton, -- :: Char -> ByteString - pack, -- :: String -> ByteString - unpack, -- :: ByteString -> String - B.fromStrict, -- :: ByteString -> Lazy.ByteString - B.toStrict, -- :: Lazy.ByteString -> ByteString + empty, + singleton, + pack, + unpack, + B.fromStrict, + B.toStrict, -- * Basic interface - cons, -- :: Char -> ByteString -> ByteString - snoc, -- :: ByteString -> Char -> ByteString - append, -- :: ByteString -> ByteString -> ByteString - head, -- :: ByteString -> Char - uncons, -- :: ByteString -> Maybe (Char, ByteString) - unsnoc, -- :: ByteString -> Maybe (ByteString, Char) - last, -- :: ByteString -> Char - tail, -- :: ByteString -> ByteString - init, -- :: ByteString -> ByteString - null, -- :: ByteString -> Bool - length, -- :: ByteString -> Int + cons, + snoc, + append, + head, + uncons, + unsnoc, + last, + tail, + init, + null, + length, -- * Transforming ByteStrings - map, -- :: (Char -> Char) -> ByteString -> ByteString - reverse, -- :: ByteString -> ByteString - intersperse, -- :: Char -> ByteString -> ByteString - intercalate, -- :: ByteString -> [ByteString] -> ByteString - transpose, -- :: [ByteString] -> [ByteString] + map, + reverse, + intersperse, + intercalate, + transpose, -- * Reducing 'ByteString's (folds) - foldl, -- :: (a -> Char -> a) -> a -> ByteString -> a - foldl', -- :: (a -> Char -> a) -> a -> ByteString -> a - foldl1, -- :: (Char -> Char -> Char) -> ByteString -> Char - foldl1', -- :: (Char -> Char -> Char) -> ByteString -> Char + foldl, + foldl', + foldl1, + foldl1', - foldr, -- :: (Char -> a -> a) -> a -> ByteString -> a - foldr', -- :: (Char -> a -> a) -> a -> ByteString -> a - foldr1, -- :: (Char -> Char -> Char) -> ByteString -> Char - foldr1', -- :: (Char -> Char -> Char) -> ByteString -> Char + foldr, + foldr', + foldr1, + foldr1', -- ** Special folds - concat, -- :: [ByteString] -> ByteString - concatMap, -- :: (Char -> ByteString) -> ByteString -> ByteString - any, -- :: (Char -> Bool) -> ByteString -> Bool - all, -- :: (Char -> Bool) -> ByteString -> Bool - maximum, -- :: ByteString -> Char - minimum, -- :: ByteString -> Char + concat, + concatMap, + any, + all, + maximum, + minimum, -- * Building ByteStrings -- ** Scans - scanl, -- :: (Char -> Char -> Char) -> Char -> ByteString -> ByteString - scanl1, -- :: (Char -> Char -> Char) -> ByteString -> ByteString - scanr, -- :: (Char -> Char -> Char) -> Char -> ByteString -> ByteString - scanr1, -- :: (Char -> Char -> Char) -> ByteString -> ByteString + scanl, + scanl1, + scanr, + scanr1, -- ** Accumulating maps - mapAccumL, -- :: (acc -> Char -> (acc, Char)) -> acc -> ByteString -> (acc, ByteString) - mapAccumR, -- :: (acc -> Char -> (acc, Char)) -> acc -> ByteString -> (acc, ByteString) + mapAccumL, + mapAccumR, -- ** Generating and unfolding ByteStrings - replicate, -- :: Int -> Char -> ByteString - unfoldr, -- :: (a -> Maybe (Char, a)) -> a -> ByteString - unfoldrN, -- :: Int -> (a -> Maybe (Char, a)) -> a -> (ByteString, Maybe a) + replicate, + unfoldr, + unfoldrN, -- * Substrings -- ** Breaking strings - take, -- :: Int -> ByteString -> ByteString - takeEnd, -- :: Int -> ByteString -> ByteString - drop, -- :: Int -> ByteString -> ByteString - dropEnd, -- :: Int -> ByteString -> ByteString - splitAt, -- :: Int -> ByteString -> (ByteString, ByteString) - takeWhile, -- :: (Char -> Bool) -> ByteString -> ByteString - takeWhileEnd, -- :: (Char -> Bool) -> ByteString -> ByteString - dropWhile, -- :: (Char -> Bool) -> ByteString -> ByteString - dropWhileEnd, -- :: (Char -> Bool) -> ByteString -> ByteString - dropSpace, -- :: ByteString -> ByteString - span, -- :: (Char -> Bool) -> ByteString -> (ByteString, ByteString) - spanEnd, -- :: (Char -> Bool) -> ByteString -> (ByteString, ByteString) - break, -- :: (Char -> Bool) -> ByteString -> (ByteString, ByteString) - breakEnd, -- :: (Char -> Bool) -> ByteString -> (ByteString, ByteString) - group, -- :: ByteString -> [ByteString] - groupBy, -- :: (Char -> Char -> Bool) -> ByteString -> [ByteString] - inits, -- :: ByteString -> [ByteString] - tails, -- :: ByteString -> [ByteString] - strip, -- :: ByteString -> ByteString - stripPrefix, -- :: ByteString -> ByteString -> Maybe ByteString - stripSuffix, -- :: ByteString -> ByteString -> Maybe ByteString + take, + takeEnd, + drop, + dropEnd, + splitAt, + takeWhile, + takeWhileEnd, + dropWhile, + dropWhileEnd, + dropSpace, + span, + spanEnd, + break, + breakEnd, + group, + groupBy, + inits, + tails, + strip, + stripPrefix, + stripSuffix, -- ** Breaking into many substrings - split, -- :: Char -> ByteString -> [ByteString] - splitWith, -- :: (Char -> Bool) -> ByteString -> [ByteString] + split, + splitWith, -- ** Breaking into lines and words - lines, -- :: ByteString -> [ByteString] - words, -- :: ByteString -> [ByteString] - unlines, -- :: [ByteString] -> ByteString - unwords, -- :: [ByteString] -> ByteString + lines, + words, + unlines, + unwords, -- * Predicates - isPrefixOf, -- :: ByteString -> ByteString -> Bool - isSuffixOf, -- :: ByteString -> ByteString -> Bool - isInfixOf, -- :: ByteString -> ByteString -> Bool + isPrefixOf, + isSuffixOf, + isInfixOf, -- ** Search for arbitrary substrings - breakSubstring, -- :: ByteString -> ByteString -> (ByteString,ByteString) + breakSubstring, -- * Searching ByteStrings -- ** Searching by equality - elem, -- :: Char -> ByteString -> Bool - notElem, -- :: Char -> ByteString -> Bool + elem, + notElem, -- ** Searching with a predicate - find, -- :: (Char -> Bool) -> ByteString -> Maybe Char - filter, -- :: (Char -> Bool) -> ByteString -> ByteString - partition, -- :: (Char -> Bool) -> ByteString -> (ByteString, ByteString) + find, + filter, + partition, -- * Indexing ByteStrings - index, -- :: ByteString -> Int -> Char - indexMaybe, -- :: ByteString -> Int -> Maybe Char - (!?), -- :: ByteString -> Int -> Maybe Char - elemIndex, -- :: Char -> ByteString -> Maybe Int - elemIndices, -- :: Char -> ByteString -> [Int] - elemIndexEnd, -- :: Char -> ByteString -> Maybe Int - findIndex, -- :: (Char -> Bool) -> ByteString -> Maybe Int - findIndices, -- :: (Char -> Bool) -> ByteString -> [Int] - findIndexEnd, -- :: (Char -> Bool) -> ByteString -> Maybe Int - count, -- :: Char -> ByteString -> Int + index, + indexMaybe, + (!?), + elemIndex, + elemIndices, + elemIndexEnd, + findIndex, + findIndices, + findIndexEnd, + count, -- * Zipping and unzipping ByteStrings - zip, -- :: ByteString -> ByteString -> [(Char,Char)] - zipWith, -- :: (Char -> Char -> c) -> ByteString -> ByteString -> [c] - packZipWith, -- :: (Char -> Char -> Char) -> ByteString -> ByteString -> ByteString - unzip, -- :: [(Char,Char)] -> (ByteString,ByteString) + zip, + zipWith, + packZipWith, + unzip, -- * Ordered ByteStrings - sort, -- :: ByteString -> ByteString + sort, -- * Reading from ByteStrings - readInt, -- :: ByteString -> Maybe (Int, ByteString) - readInteger, -- :: ByteString -> Maybe (Integer, ByteString) + readInt, + readInteger, -- * Low level CString conversions -- ** Copying ByteStrings - copy, -- :: ByteString -> ByteString + copy, -- ** Packing CStrings and pointers - packCString, -- :: CString -> IO ByteString - packCStringLen, -- :: CStringLen -> IO ByteString + packCString, + packCStringLen, -- ** Using ByteStrings as CStrings - useAsCString, -- :: ByteString -> (CString -> IO a) -> IO a - useAsCStringLen, -- :: ByteString -> (CStringLen -> IO a) -> IO a + useAsCString, + useAsCStringLen, -- * I\/O with 'ByteString's -- | ByteString I/O uses binary mode, without any character decoding @@ -206,28 +206,28 @@ module Data.ByteString.Char8 ( -- newline mode is considered a flaw and may be changed in a future version. -- ** Standard input and output - getLine, -- :: IO ByteString - getContents, -- :: IO ByteString - putStr, -- :: ByteString -> IO () - putStrLn, -- :: ByteString -> IO () - interact, -- :: (ByteString -> ByteString) -> IO () + getLine, + getContents, + putStr, + putStrLn, + interact, -- ** Files - readFile, -- :: FilePath -> IO ByteString - writeFile, -- :: FilePath -> ByteString -> IO () - appendFile, -- :: FilePath -> ByteString -> IO () --- mmapFile, -- :: FilePath -> IO ByteString + readFile, + writeFile, + appendFile, +-- mmapFile, -- ** I\/O with Handles - hGetLine, -- :: Handle -> IO ByteString - hGetContents, -- :: Handle -> IO ByteString - hGet, -- :: Handle -> Int -> IO ByteString - hGetSome, -- :: Handle -> Int -> IO ByteString - hGetNonBlocking, -- :: Handle -> Int -> IO ByteString - hPut, -- :: Handle -> ByteString -> IO () - hPutNonBlocking, -- :: Handle -> ByteString -> IO ByteString - hPutStr, -- :: Handle -> ByteString -> IO () - hPutStrLn, -- :: Handle -> ByteString -> IO () + hGetLine, + hGetContents, + hGet, + hGetSome, + hGetNonBlocking, + hPut, + hPutNonBlocking, + hPutStr, + hPutStrLn, ) where diff --git a/Data/ByteString/Internal.hs b/Data/ByteString/Internal.hs index 44b0ed80b..8e3226c16 100644 --- a/Data/ByteString/Internal.hs +++ b/Data/ByteString/Internal.hs @@ -30,7 +30,7 @@ module Data.ByteString.Internal ( ByteString ( BS , PS -- backwards compatibility shim - ), -- instances: Eq, Ord, Show, Read, Data, Typeable + ), -- * Internal indexing findIndexOrLength, @@ -43,48 +43,48 @@ module Data.ByteString.Internal ( unsafePackAddress, unsafePackLiteral, -- * Low level imperative construction - create, -- :: Int -> (Ptr Word8 -> IO ()) -> IO ByteString - createUptoN, -- :: Int -> (Ptr Word8 -> IO Int) -> IO ByteString - createUptoN', -- :: Int -> (Ptr Word8 -> IO (Int, a)) -> IO (ByteString, a) - createAndTrim, -- :: Int -> (Ptr Word8 -> IO Int) -> IO ByteString - createAndTrim', -- :: Int -> (Ptr Word8 -> IO (Int, Int, a)) -> IO (ByteString, a) - unsafeCreate, -- :: Int -> (Ptr Word8 -> IO ()) -> ByteString - unsafeCreateUptoN, -- :: Int -> (Ptr Word8 -> IO Int) -> ByteString - unsafeCreateUptoN', -- :: Int -> (Ptr Word8 -> IO (Int, a)) -> (ByteString, a) - mallocByteString, -- :: Int -> IO (ForeignPtr a) + create, + createUptoN, + createUptoN', + createAndTrim, + createAndTrim', + unsafeCreate, + unsafeCreateUptoN, + unsafeCreateUptoN', + mallocByteString, -- * Conversion to and from ForeignPtrs - fromForeignPtr, -- :: ForeignPtr Word8 -> Int -> Int -> ByteString - toForeignPtr, -- :: ByteString -> (ForeignPtr Word8, Int, Int) - fromForeignPtr0, -- :: ForeignPtr Word8 -> Int -> ByteString - toForeignPtr0, -- :: ByteString -> (ForeignPtr Word8, Int) + fromForeignPtr, + toForeignPtr, + fromForeignPtr0, + toForeignPtr0, -- * Utilities - nullForeignPtr, -- :: ForeignPtr Word8 - checkedAdd, -- :: String -> Int -> Int -> Int + nullForeignPtr, + checkedAdd, -- * Standard C Functions - c_strlen, -- :: CString -> IO CInt - c_free_finalizer, -- :: FunPtr (Ptr Word8 -> IO ()) + c_strlen, + c_free_finalizer, - memchr, -- :: Ptr Word8 -> Word8 -> CSize -> IO Ptr Word8 - memcmp, -- :: Ptr Word8 -> Ptr Word8 -> Int -> IO CInt - memcpy, -- :: Ptr Word8 -> Ptr Word8 -> Int -> IO () - memset, -- :: Ptr Word8 -> Word8 -> CSize -> IO (Ptr Word8) + memchr, + memcmp, + memcpy, + memset, -- * cbits functions - c_reverse, -- :: Ptr Word8 -> Ptr Word8 -> CSize -> IO () - c_intersperse, -- :: Ptr Word8 -> Ptr Word8 -> CSize -> Word8 -> IO () - c_maximum, -- :: Ptr Word8 -> CSize -> IO Word8 - c_minimum, -- :: Ptr Word8 -> CSize -> IO Word8 - c_count, -- :: Ptr Word8 -> CSize -> Word8 -> IO CSize - c_sort, -- :: Ptr Word8 -> CSize -> IO () + c_reverse, + c_intersperse, + c_maximum, + c_minimum, + c_count, + c_sort, -- * Chars w2c, c2w, isSpaceWord8, isSpaceChar8, -- * Deprecated and unmentionable - accursedUnutterablePerformIO, -- :: IO a -> a + accursedUnutterablePerformIO, -- * Exported compatibility shim plusForeignPtr, diff --git a/Data/ByteString/Lazy.hs b/Data/ByteString/Lazy.hs index 9f413bb6c..5cc9a4461 100644 --- a/Data/ByteString/Lazy.hs +++ b/Data/ByteString/Lazy.hs @@ -50,164 +50,164 @@ module Data.ByteString.Lazy ( -- * The @ByteString@ type - ByteString, -- instances: Eq, Ord, Show, Read, Data, Typeable + ByteString, -- * Introducing and eliminating 'ByteString's - empty, -- :: ByteString - singleton, -- :: Word8 -> ByteString - pack, -- :: [Word8] -> ByteString - unpack, -- :: ByteString -> [Word8] - fromStrict, -- :: Strict.ByteString -> ByteString - toStrict, -- :: ByteString -> Strict.ByteString - fromChunks, -- :: [Strict.ByteString] -> ByteString - toChunks, -- :: ByteString -> [Strict.ByteString] - foldrChunks, -- :: (S.ByteString -> a -> a) -> a -> ByteString -> a - foldlChunks, -- :: (a -> S.ByteString -> a) -> a -> ByteString -> a + empty, + singleton, + pack, + unpack, + fromStrict, + toStrict, + fromChunks, + toChunks, + foldrChunks, + foldlChunks, -- * Basic interface - cons, -- :: Word8 -> ByteString -> ByteString - cons', -- :: Word8 -> ByteString -> ByteString - snoc, -- :: ByteString -> Word8 -> ByteString - append, -- :: ByteString -> ByteString -> ByteString - head, -- :: ByteString -> Word8 - uncons, -- :: ByteString -> Maybe (Word8, ByteString) - unsnoc, -- :: ByteString -> Maybe (ByteString, Word8) - last, -- :: ByteString -> Word8 - tail, -- :: ByteString -> ByteString - init, -- :: ByteString -> ByteString - null, -- :: ByteString -> Bool - length, -- :: ByteString -> Int64 + cons, + cons', + snoc, + append, + head, + uncons, + unsnoc, + last, + tail, + init, + null, + length, -- * Transforming ByteStrings - map, -- :: (Word8 -> Word8) -> ByteString -> ByteString - reverse, -- :: ByteString -> ByteString - intersperse, -- :: Word8 -> ByteString -> ByteString - intercalate, -- :: ByteString -> [ByteString] -> ByteString - transpose, -- :: [ByteString] -> [ByteString] + map, + reverse, + intersperse, + intercalate, + transpose, -- * Reducing 'ByteString's (folds) - foldl, -- :: (a -> Word8 -> a) -> a -> ByteString -> a - foldl', -- :: (a -> Word8 -> a) -> a -> ByteString -> a - foldl1, -- :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8 - foldl1', -- :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8 - foldr, -- :: (Word8 -> a -> a) -> a -> ByteString -> a - foldr1, -- :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8 + foldl, + foldl', + foldl1, + foldl1', + foldr, + foldr1, -- ** Special folds - concat, -- :: [ByteString] -> ByteString - concatMap, -- :: (Word8 -> ByteString) -> ByteString -> ByteString - any, -- :: (Word8 -> Bool) -> ByteString -> Bool - all, -- :: (Word8 -> Bool) -> ByteString -> Bool - maximum, -- :: ByteString -> Word8 - minimum, -- :: ByteString -> Word8 - compareLength, -- :: ByteString -> Int64 -> Ordering + concat, + concatMap, + any, + all, + maximum, + minimum, + compareLength, -- * Building ByteStrings -- ** Scans - scanl, -- :: (Word8 -> Word8 -> Word8) -> Word8 -> ByteString -> ByteString --- scanl1, -- :: (Word8 -> Word8 -> Word8) -> ByteString -> ByteString --- scanr, -- :: (Word8 -> Word8 -> Word8) -> Word8 -> ByteString -> ByteString --- scanr1, -- :: (Word8 -> Word8 -> Word8) -> ByteString -> ByteString + scanl, +-- scanl1, +-- scanr, +-- scanr1, -- ** Accumulating maps - mapAccumL, -- :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString) - mapAccumR, -- :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString) + mapAccumL, + mapAccumR, -- ** Infinite ByteStrings - repeat, -- :: Word8 -> ByteString - replicate, -- :: Int64 -> Word8 -> ByteString - cycle, -- :: ByteString -> ByteString - iterate, -- :: (Word8 -> Word8) -> Word8 -> ByteString + repeat, + replicate, + cycle, + iterate, -- ** Unfolding ByteStrings - unfoldr, -- :: (a -> Maybe (Word8, a)) -> a -> ByteString + unfoldr, -- * Substrings -- ** Breaking strings - take, -- :: Int64 -> ByteString -> ByteString - drop, -- :: Int64 -> ByteString -> ByteString - splitAt, -- :: Int64 -> ByteString -> (ByteString, ByteString) - takeWhile, -- :: (Word8 -> Bool) -> ByteString -> ByteString - dropWhile, -- :: (Word8 -> Bool) -> ByteString -> ByteString - span, -- :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString) - break, -- :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString) - group, -- :: ByteString -> [ByteString] - groupBy, -- :: (Word8 -> Word8 -> Bool) -> ByteString -> [ByteString] - inits, -- :: ByteString -> [ByteString] - tails, -- :: ByteString -> [ByteString] - stripPrefix, -- :: ByteString -> ByteString -> Maybe ByteString - stripSuffix, -- :: ByteString -> ByteString -> Maybe ByteString + take, + drop, + splitAt, + takeWhile, + dropWhile, + span, + break, + group, + groupBy, + inits, + tails, + stripPrefix, + stripSuffix, -- ** Breaking into many substrings - split, -- :: Word8 -> ByteString -> [ByteString] - splitWith, -- :: (Word8 -> Bool) -> ByteString -> [ByteString] + split, + splitWith, -- * Predicates - isPrefixOf, -- :: ByteString -> ByteString -> Bool - isSuffixOf, -- :: ByteString -> ByteString -> Bool --- isInfixOf, -- :: ByteString -> ByteString -> Bool + isPrefixOf, + isSuffixOf, +-- isInfixOf, -- ** Search for arbitrary substrings --- isSubstringOf, -- :: ByteString -> ByteString -> Bool +-- isSubstringOf, -- * Searching ByteStrings -- ** Searching by equality - elem, -- :: Word8 -> ByteString -> Bool - notElem, -- :: Word8 -> ByteString -> Bool + elem, + notElem, -- ** Searching with a predicate - find, -- :: (Word8 -> Bool) -> ByteString -> Maybe Word8 - filter, -- :: (Word8 -> Bool) -> ByteString -> ByteString - partition, -- :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString) + find, + filter, + partition, -- * Indexing ByteStrings - index, -- :: ByteString -> Int64 -> Word8 - indexMaybe, -- :: ByteString -> Int64 -> Maybe Word8 - (!?), -- :: ByteString -> Int64 -> Maybe Word8 - elemIndex, -- :: Word8 -> ByteString -> Maybe Int64 - elemIndexEnd, -- :: Word8 -> ByteString -> Maybe Int64 - elemIndices, -- :: Word8 -> ByteString -> [Int64] - findIndex, -- :: (Word8 -> Bool) -> ByteString -> Maybe Int64 - findIndexEnd, -- :: (Word8 -> Bool) -> ByteString -> Maybe Int64 - findIndices, -- :: (Word8 -> Bool) -> ByteString -> [Int64] - count, -- :: Word8 -> ByteString -> Int64 + index, + indexMaybe, + (!?), + elemIndex, + elemIndexEnd, + elemIndices, + findIndex, + findIndexEnd, + findIndices, + count, -- * Zipping and unzipping ByteStrings - zip, -- :: ByteString -> ByteString -> [(Word8,Word8)] - zipWith, -- :: (Word8 -> Word8 -> c) -> ByteString -> ByteString -> [c] - packZipWith, -- :: (Word8 -> Word8 -> Word8) -> ByteString -> ByteString -> ByteString - unzip, -- :: [(Word8,Word8)] -> (ByteString,ByteString) + zip, + zipWith, + packZipWith, + unzip, -- * Ordered ByteStrings --- sort, -- :: ByteString -> ByteString +-- sort, -- * Low level conversions -- ** Copying ByteStrings - copy, -- :: ByteString -> ByteString --- defrag, -- :: ByteString -> ByteString + copy, +-- defrag, -- * I\/O with 'ByteString's -- $IOChunk -- ** Standard input and output - getContents, -- :: IO ByteString - putStr, -- :: ByteString -> IO () - interact, -- :: (ByteString -> ByteString) -> IO () + getContents, + putStr, + interact, -- ** Files - readFile, -- :: FilePath -> IO ByteString - writeFile, -- :: FilePath -> ByteString -> IO () - appendFile, -- :: FilePath -> ByteString -> IO () + readFile, + writeFile, + appendFile, -- ** I\/O with Handles - hGetContents, -- :: Handle -> IO ByteString - hGet, -- :: Handle -> Int -> IO ByteString - hGetNonBlocking, -- :: Handle -> Int -> IO ByteString - hPut, -- :: Handle -> ByteString -> IO () - hPutNonBlocking, -- :: Handle -> ByteString -> IO ByteString - hPutStr, -- :: Handle -> ByteString -> IO () + hGetContents, + hGet, + hGetNonBlocking, + hPut, + hPutNonBlocking, + hPutStr, ) where diff --git a/Data/ByteString/Lazy/Char8.hs b/Data/ByteString/Lazy/Char8.hs index 6b8ecfee7..4d74f4247 100644 --- a/Data/ByteString/Lazy/Char8.hs +++ b/Data/ByteString/Lazy/Char8.hs @@ -31,142 +31,142 @@ module Data.ByteString.Lazy.Char8 ( -- * The @ByteString@ type - ByteString, -- instances: Eq, Ord, Show, Read, Data, Typeable + ByteString, -- * Introducing and eliminating 'ByteString's - empty, -- :: ByteString - singleton, -- :: Char -> ByteString - pack, -- :: String -> ByteString - unpack, -- :: ByteString -> String - fromChunks, -- :: [Strict.ByteString] -> ByteString - toChunks, -- :: ByteString -> [Strict.ByteString] - fromStrict, -- :: Strict.ByteString -> ByteString - toStrict, -- :: ByteString -> Strict.ByteString + empty, + singleton, + pack, + unpack, + fromChunks, + toChunks, + fromStrict, + toStrict, -- * Basic interface - cons, -- :: Char -> ByteString -> ByteString - cons', -- :: Char -> ByteString -> ByteString - snoc, -- :: ByteString -> Char -> ByteString - append, -- :: ByteString -> ByteString -> ByteString - head, -- :: ByteString -> Char - uncons, -- :: ByteString -> Maybe (Char, ByteString) - last, -- :: ByteString -> Char - tail, -- :: ByteString -> ByteString - unsnoc, -- :: ByteString -> Maybe (ByteString, Char) - init, -- :: ByteString -> ByteString - null, -- :: ByteString -> Bool - length, -- :: ByteString -> Int64 + cons, + cons', + snoc, + append, + head, + uncons, + last, + tail, + unsnoc, + init, + null, + length, -- * Transforming ByteStrings - map, -- :: (Char -> Char) -> ByteString -> ByteString - reverse, -- :: ByteString -> ByteString - intersperse, -- :: Char -> ByteString -> ByteString - intercalate, -- :: ByteString -> [ByteString] -> ByteString - transpose, -- :: [ByteString] -> [ByteString] + map, + reverse, + intersperse, + intercalate, + transpose, -- * Reducing 'ByteString's (folds) - foldl, -- :: (a -> Char -> a) -> a -> ByteString -> a - foldl', -- :: (a -> Char -> a) -> a -> ByteString -> a - foldl1, -- :: (Char -> Char -> Char) -> ByteString -> Char - foldl1', -- :: (Char -> Char -> Char) -> ByteString -> Char - foldr, -- :: (Char -> a -> a) -> a -> ByteString -> a - foldr1, -- :: (Char -> Char -> Char) -> ByteString -> Char + foldl, + foldl', + foldl1, + foldl1', + foldr, + foldr1, -- ** Special folds - concat, -- :: [ByteString] -> ByteString - concatMap, -- :: (Char -> ByteString) -> ByteString -> ByteString - any, -- :: (Char -> Bool) -> ByteString -> Bool - all, -- :: (Char -> Bool) -> ByteString -> Bool - maximum, -- :: ByteString -> Char - minimum, -- :: ByteString -> Char - compareLength, -- :: ByteString -> Int -> Ordering + concat, + concatMap, + any, + all, + maximum, + minimum, + compareLength, -- * Building ByteStrings -- ** Scans - scanl, -- :: (Char -> Char -> Char) -> Char -> ByteString -> ByteString --- scanl1, -- :: (Char -> Char -> Char) -> ByteString -> ByteString --- scanr, -- :: (Char -> Char -> Char) -> Char -> ByteString -> ByteString --- scanr1, -- :: (Char -> Char -> Char) -> ByteString -> ByteString + scanl, +-- scanl1, +-- scanr, +-- scanr1, -- ** Accumulating maps - mapAccumL, -- :: (acc -> Char -> (acc, Char)) -> acc -> ByteString -> (acc, ByteString) - mapAccumR, -- :: (acc -> Char -> (acc, Char)) -> acc -> ByteString -> (acc, ByteString) + mapAccumL, + mapAccumR, -- ** Infinite ByteStrings - repeat, -- :: Char -> ByteString - replicate, -- :: Int64 -> Char -> ByteString - cycle, -- :: ByteString -> ByteString - iterate, -- :: (Char -> Char) -> Char -> ByteString + repeat, + replicate, + cycle, + iterate, -- ** Unfolding ByteStrings - unfoldr, -- :: (a -> Maybe (Char, a)) -> a -> ByteString + unfoldr, -- * Substrings -- ** Breaking strings - take, -- :: Int64 -> ByteString -> ByteString - drop, -- :: Int64 -> ByteString -> ByteString - splitAt, -- :: Int64 -> ByteString -> (ByteString, ByteString) - takeWhile, -- :: (Char -> Bool) -> ByteString -> ByteString - dropWhile, -- :: (Char -> Bool) -> ByteString -> ByteString - span, -- :: (Char -> Bool) -> ByteString -> (ByteString, ByteString) - break, -- :: (Char -> Bool) -> ByteString -> (ByteString, ByteString) - group, -- :: ByteString -> [ByteString] - groupBy, -- :: (Char -> Char -> Bool) -> ByteString -> [ByteString] - inits, -- :: ByteString -> [ByteString] - tails, -- :: ByteString -> [ByteString] - stripPrefix, -- :: ByteString -> ByteString -> Maybe ByteString - stripSuffix, -- :: ByteString -> ByteString -> Maybe ByteString + take, + drop, + splitAt, + takeWhile, + dropWhile, + span, + break, + group, + groupBy, + inits, + tails, + stripPrefix, + stripSuffix, -- ** Breaking into many substrings - split, -- :: Char -> ByteString -> [ByteString] - splitWith, -- :: (Char -> Bool) -> ByteString -> [ByteString] + split, + splitWith, -- ** Breaking into lines and words - lines, -- :: ByteString -> [ByteString] - words, -- :: ByteString -> [ByteString] - unlines, -- :: [ByteString] -> ByteString - unwords, -- :: ByteString -> [ByteString] + lines, + words, + unlines, + unwords, -- * Predicates - isPrefixOf, -- :: ByteString -> ByteString -> Bool - isSuffixOf, -- :: ByteString -> ByteString -> Bool + isPrefixOf, + isSuffixOf, -- * Searching ByteStrings -- ** Searching by equality - elem, -- :: Char -> ByteString -> Bool - notElem, -- :: Char -> ByteString -> Bool + elem, + notElem, -- ** Searching with a predicate - find, -- :: (Char -> Bool) -> ByteString -> Maybe Char - filter, -- :: (Char -> Bool) -> ByteString -> ByteString - partition, -- :: (Char -> Bool) -> ByteString -> (ByteString, ByteString) + find, + filter, + partition, -- * Indexing ByteStrings - index, -- :: ByteString -> Int64 -> Char - indexMaybe, -- :: ByteString -> Int64 -> Maybe Char - (!?), -- :: ByteString -> Int64 -> Maybe Char - elemIndex, -- :: Char -> ByteString -> Maybe Int64 - elemIndexEnd, -- :: Char -> ByteString -> Maybe Int64 - elemIndices, -- :: Char -> ByteString -> [Int64] - findIndex, -- :: (Char -> Bool) -> ByteString -> Maybe Int64 - findIndexEnd, -- :: (Char -> Bool) -> ByteString -> Maybe Int64 - findIndices, -- :: (Char -> Bool) -> ByteString -> [Int64] - count, -- :: Char -> ByteString -> Int64 + index, + indexMaybe, + (!?), + elemIndex, + elemIndexEnd, + elemIndices, + findIndex, + findIndexEnd, + findIndices, + count, -- * Zipping and unzipping ByteStrings - zip, -- :: ByteString -> ByteString -> [(Char,Char)] - zipWith, -- :: (Char -> Char -> c) -> ByteString -> ByteString -> [c] - packZipWith, -- :: (Char -> Char -> Char) -> ByteString -> ByteString -> ByteString - unzip, -- :: [(Char,Char)] -> (ByteString,ByteString) + zip, + zipWith, + packZipWith, + unzip, -- * Ordered ByteStrings --- sort, -- :: ByteString -> ByteString +-- sort, -- * Low level conversions -- ** Copying ByteStrings - copy, -- :: ByteString -> ByteString + copy, -- * Reading from ByteStrings readInt, @@ -178,24 +178,24 @@ module Data.ByteString.Lazy.Char8 ( -- newline mode is considered a flaw and may be changed in a future version. -- ** Standard input and output - getContents, -- :: IO ByteString - putStr, -- :: ByteString -> IO () - putStrLn, -- :: ByteString -> IO () - interact, -- :: (ByteString -> ByteString) -> IO () + getContents, + putStr, + putStrLn, + interact, -- ** Files - readFile, -- :: FilePath -> IO ByteString - writeFile, -- :: FilePath -> ByteString -> IO () - appendFile, -- :: FilePath -> ByteString -> IO () + readFile, + writeFile, + appendFile, -- ** I\/O with Handles - hGetContents, -- :: Handle -> IO ByteString - hGet, -- :: Handle -> Int64 -> IO ByteString - hGetNonBlocking, -- :: Handle -> Int64 -> IO ByteString - hPut, -- :: Handle -> ByteString -> IO () - hPutNonBlocking, -- :: Handle -> ByteString -> IO ByteString - hPutStr, -- :: Handle -> ByteString -> IO () - hPutStrLn, -- :: Handle -> ByteString -> IO () + hGetContents, + hGet, + hGetNonBlocking, + hPut, + hPutNonBlocking, + hPutStr, + hPutStrLn, ) where diff --git a/Data/ByteString/Lazy/Internal.hs b/Data/ByteString/Lazy/Internal.hs index 864bf3cab..a99464816 100644 --- a/Data/ByteString/Lazy/Internal.hs +++ b/Data/ByteString/Lazy/Internal.hs @@ -23,7 +23,7 @@ module Data.ByteString.Lazy.Internal ( -- * The lazy @ByteString@ type and representation - ByteString(..), -- instances: Eq, Ord, Show, Read, Data, Typeable + ByteString(..), chunk, foldrChunks, foldlChunks, diff --git a/Data/ByteString/Unsafe.hs b/Data/ByteString/Unsafe.hs index 4b8dabb69..f15bc619c 100644 --- a/Data/ByteString/Unsafe.hs +++ b/Data/ByteString/Unsafe.hs @@ -19,29 +19,29 @@ module Data.ByteString.Unsafe ( -- * Unchecked access - unsafeHead, -- :: ByteString -> Word8 - unsafeTail, -- :: ByteString -> ByteString - unsafeInit, -- :: ByteString -> ByteString - unsafeLast, -- :: ByteString -> Word8 - unsafeIndex, -- :: ByteString -> Int -> Word8 - unsafeTake, -- :: Int -> ByteString -> ByteString - unsafeDrop, -- :: Int -> ByteString -> ByteString + unsafeHead, + unsafeTail, + unsafeInit, + unsafeLast, + unsafeIndex, + unsafeTake, + unsafeDrop, -- * Low level interaction with CStrings -- ** Using ByteStrings with functions for CStrings - unsafeUseAsCString, -- :: ByteString -> (CString -> IO a) -> IO a - unsafeUseAsCStringLen, -- :: ByteString -> (CStringLen -> IO a) -> IO a + unsafeUseAsCString, + unsafeUseAsCStringLen, -- ** Converting CStrings to ByteStrings - unsafePackCString, -- :: CString -> IO ByteString - unsafePackCStringLen, -- :: CStringLen -> IO ByteString - unsafePackMallocCString,-- :: CString -> IO ByteString - unsafePackMallocCStringLen, -- :: CStringLen -> IO ByteString - - unsafePackAddress, -- :: Addr# -> IO ByteString - unsafePackAddressLen, -- :: Int -> Addr# -> IO ByteString - unsafePackCStringFinalizer, -- :: Ptr Word8 -> Int -> IO () -> IO ByteString - unsafeFinalize, -- :: ByteString -> IO () + unsafePackCString, + unsafePackCStringLen, + unsafePackMallocCString, + unsafePackMallocCStringLen, + + unsafePackAddress, + unsafePackAddressLen, + unsafePackCStringFinalizer, + unsafeFinalize, ) where