Remove Control.Parallel*, now in package parallel
[haskell-directory.git] / Data / ByteString / Lazy.hs
index 92c28a8..c9d3bdb 100644 (file)
@@ -1,18 +1,15 @@
 {-# OPTIONS_GHC -cpp -fglasgow-exts -fno-warn-orphans -fno-warn-incomplete-patterns #-}
---
--- Module      : ByteString.Lazy
+-- |
+-- Module      : Data.ByteString.Lazy
 -- Copyright   : (c) Don Stewart 2006
 --               (c) Duncan Coutts 2006
 -- License     : BSD-style
 --
 -- Maintainer  : dons@cse.unsw.edu.au
 -- Stability   : experimental
--- Portability : portable, requires ffi and cpp
--- Tested with : GHC 6.4.1 and Hugs March 2005
+-- Portability : non-portable (instance of type synonym)
 -- 
-
---
--- | A time and space-efficient implementation of lazy byte vectors
+-- A time and space-efficient implementation of lazy byte vectors
 -- using lists of packed 'Word8' arrays, suitable for high performance
 -- use, both in terms of large data quantities, or high speed
 -- requirements. Byte vectors are encoded as lazy lists of strict 'Word8'
@@ -22,7 +19,7 @@
 -- Some operations, such as concat, append, reverse and cons, have
 -- better complexity than their "Data.ByteString" equivalents, due to
 -- optimisations resulting from the list spine structure. And for other
--- operations Lazy ByteStrings are usually within a few percent of
+-- operations lazy ByteStrings are usually within a few percent of
 -- strict ones, but with better heap usage. For data larger than the
 -- available memory, or if you have tight memory constraints, this
 -- module will be the only option. The default chunk size is 64k, which
 --
 -- > import qualified Data.ByteString.Lazy as B
 --
--- Original GHC implementation by Bryan O\'Sullivan. Rewritten to use
--- UArray by Simon Marlow. Rewritten to support slices and use
--- ForeignPtr by David Roundy. Polished and extended by Don Stewart.
+-- Original GHC implementation by Bryan O\'Sullivan.
+-- Rewritten to use 'Data.Array.Unboxed.UArray' by Simon Marlow.
+-- Rewritten to support slices and use 'Foreign.ForeignPtr.ForeignPtr'
+-- by David Roundy.
+-- Polished and extended by Don Stewart.
 -- Lazy variant by Duncan Coutts and Don Stewart.
 --
 
@@ -411,8 +410,8 @@ length (LPS ss) = L.foldl' (\n ps -> n + fromIntegral (P.length ps)) 0 ss
 -- You can however use 'repeat' and 'cycle' to build infinite lazy ByteStrings.
 --
 cons :: Word8 -> ByteString -> ByteString
-cons c (LPS (s:ss)) | P.length s <= 16 = LPS (P.cons c s : ss)
-cons c (LPS ss)                        = LPS (P.singleton c : ss)
+cons c (LPS (s:ss)) | P.length s < 16 = LPS (P.cons c s : ss)
+cons c (LPS ss)                       = LPS (P.singleton c : ss)
 {-# INLINE cons #-}
 
 -- | /O(n\/c)/ Append a byte to the end of a 'ByteString'
@@ -801,7 +800,7 @@ splitWith p (LPS (a:as)) = comb [] (P.splitWith p a) as
 -- argument, consuming the delimiter. I.e.
 --
 -- > split '\n' "a\nb\nd\ne" == ["a","b","d","e"]
--- > split 'a'  "aXaXaXa"    == ["","X","X","X"]
+-- > split 'a'  "aXaXaXa"    == ["","X","X","X",""]
 -- > split 'x'  "x"          == ["",""]
 -- 
 -- and