io-streams 1.1.4.2 → 1.1.4.3
raw patch · 18 files changed
+70/−125 lines, 18 filesdep ~networkdep ~process
Dependency ranges changed: network, process
Files
- io-streams.cabal +5/−3
- src/System/IO/Streams/Attoparsec.hs +2/−1
- src/System/IO/Streams/Builder.hs +5/−18
- src/System/IO/Streams/ByteString.hs +6/−14
- src/System/IO/Streams/Combinators.hs +4/−10
- src/System/IO/Streams/Concurrent.hs +5/−9
- src/System/IO/Streams/Core.hs +1/−0
- src/System/IO/Streams/Debug.hs +3/−0
- src/System/IO/Streams/File.hs +2/−5
- src/System/IO/Streams/Handle.hs +2/−5
- src/System/IO/Streams/Internal.hs +2/−2
- src/System/IO/Streams/Internal/Attoparsec.hs +2/−2
- src/System/IO/Streams/Internal/Search.hs +10/−9
- src/System/IO/Streams/List.hs +3/−4
- src/System/IO/Streams/Network.hs +5/−5
- src/System/IO/Streams/Process.hs +3/−5
- src/System/IO/Streams/Vector.hs +3/−6
- src/System/IO/Streams/Zlib.hs +7/−27
io-streams.cabal view
@@ -1,5 +1,5 @@ Name: io-streams-Version: 1.1.4.2+Version: 1.1.4.3 License: BSD3 License-file: LICENSE Category: Data, Network, IO-Streams@@ -81,6 +81,8 @@ . /ChangeLog/ .+ [@1.1.4.3@] Allow use of new network version 2.5.+ . [@1.1.4.2@] Fixed a build error with network versions older than 2.4. . [@1.1.4.1@] @System.IO.Streams.Network@: scalability improvement: buffers@@ -182,7 +184,7 @@ attoparsec >= 0.10 && <0.12, blaze-builder >= 0.3.1 && <0.4, bytestring >= 0.9 && <0.11,- network >= 2.3 && <2.5,+ network >= 2.3 && <2.6, primitive >= 0.2 && <0.6, process >= 1 && <1.3, text >= 0.10 && <1.2,@@ -266,7 +268,7 @@ directory >= 1.1 && <2, filepath >= 1.2 && <2, mtl >= 2 && <3,- network >= 2.3 && <2.5,+ network >= 2.3 && <2.6, primitive >= 0.2 && <0.6, process >= 1 && <1.3, text >= 0.10 && <1.2,
src/System/IO/Streams/Attoparsec.hs view
@@ -8,4 +8,5 @@ , ParseException(..) ) where -import System.IO.Streams.Internal.Attoparsec+------------------------------------------------------------------------------+import System.IO.Streams.Internal.Attoparsec (ParseException (..), parseFromStream, parserToInputStream)
src/System/IO/Streams/Builder.hs view
@@ -71,28 +71,15 @@ ) where -------------------------------------------------------------------------------import Blaze.ByteString.Builder.Internal (defaultBufferSize)--------------------------------------------------------------------------------import Blaze.ByteString.Builder.Internal.Types (BufRange (..),- BuildSignal (..),- Builder (..),- buildStep)--------------------------------------------------------------------------------import Blaze.ByteString.Builder.Internal.Buffer (Buffer, BufferAllocStrategy, allNewBuffersStrategy,- execBuildStep, reuseBufferStrategy,- unsafeFreezeBuffer, unsafeFreezeNonEmptyBuffer,- updateEndOfSlice)------------------------------------------------------------------------------- import Control.Monad (when) import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as S-import Data.IORef (newIORef,- readIORef,- writeIORef)+import Data.IORef (newIORef, readIORef, writeIORef) -------------------------------------------------------------------------------import System.IO.Streams.Internal (OutputStream,- makeOutputStream,- write)+import Blaze.ByteString.Builder.Internal (defaultBufferSize)+import Blaze.ByteString.Builder.Internal.Types (BufRange (..), BuildSignal (..), Builder (..), buildStep)+import Blaze.ByteString.Builder.Internal.Buffer (Buffer, BufferAllocStrategy, allNewBuffersStrategy, execBuildStep, reuseBufferStrategy, unsafeFreezeBuffer, unsafeFreezeNonEmptyBuffer, updateEndOfSlice)+import System.IO.Streams.Internal (OutputStream, makeOutputStream, write) ------------------------------------------------------------------------------
src/System/IO/Streams/ByteString.hs view
@@ -58,26 +58,18 @@ import qualified Data.ByteString.Unsafe as S import Data.Char (isSpace) import Data.Int (Int64)-import Data.IORef (IORef, newIORef,- readIORef, writeIORef)+import Data.IORef (IORef, newIORef, readIORef, writeIORef) import Data.Time.Clock.POSIX (getPOSIXTime) import Data.Typeable (Typeable)--import Prelude hiding (lines, read,- takeWhile, unlines,- unwords, words)+import Prelude hiding (read, lines, unlines, words, unwords) -------------------------------------------------------------------------------import System.IO.Streams.Combinators (filterM, intersperse,- outputFoldM)-import System.IO.Streams.Internal (InputStream (..),- OutputStream,- makeInputStream,- makeOutputStream, read,- unRead, write)+import System.IO.Streams.Combinators (filterM, intersperse, outputFoldM)+import System.IO.Streams.Internal (InputStream (..), OutputStream, makeInputStream, makeOutputStream, read, unRead, write) import System.IO.Streams.Internal.Search (MatchInfo (..), search) import System.IO.Streams.List (fromList, writeList)------------------------------------------------------------------------------- ++------------------------------------------------------------------------------ {-# INLINE modifyRef #-} modifyRef :: IORef a -> (a -> a) -> IO () modifyRef ref f = do
src/System/IO/Streams/Combinators.hs view
@@ -56,18 +56,12 @@ import Control.Monad (liftM, void, when) import Control.Monad.IO.Class (liftIO) import Data.Int (Int64)-import Data.IORef (atomicModifyIORef, modifyIORef,- newIORef, readIORef, writeIORef)+import Data.IORef (atomicModifyIORef, modifyIORef, newIORef, readIORef, writeIORef) import Data.Maybe (isJust)-import Prelude hiding (all, any, drop, filter,- map, mapM, mapM_, maximum,- minimum, read, take, unzip, zip,- zipWith)+import Prelude hiding (all, any, drop, filter, map, mapM, mapM_, maximum, minimum, read, take, unzip, zip, zipWith) -------------------------------------------------------------------------------import System.IO.Streams.Internal (InputStream (..), OutputStream,- fromGenerator, makeInputStream,- makeOutputStream, read, unRead,- write, yield)+import System.IO.Streams.Internal (InputStream (..), OutputStream, fromGenerator, makeInputStream, makeOutputStream, read, unRead, write, yield)+ ------------------------------------------------------------------------------ -- | A side-effecting fold over an 'OutputStream', as a stream transformer.
src/System/IO/Streams/Concurrent.hs view
@@ -14,18 +14,14 @@ ------------------------------------------------------------------------------ import Control.Applicative ((<$>), (<*>)) import Control.Concurrent (forkIO)-import Control.Concurrent.Chan (Chan, newChan, readChan,- writeChan)-import Control.Concurrent.MVar (modifyMVar, newEmptyMVar,- newMVar, putMVar, takeMVar)-import Control.Exception (SomeException, mask, throwIO,- try)+import Control.Concurrent.Chan (Chan, newChan, readChan, writeChan)+import Control.Concurrent.MVar (modifyMVar, newEmptyMVar, newMVar, putMVar, takeMVar)+import Control.Exception (SomeException, mask, throwIO, try) import Control.Monad (forM_) import Prelude hiding (read) -------------------------------------------------------------------------------import System.IO.Streams.Internal (InputStream, OutputStream,- makeInputStream,- makeOutputStream, read)+import System.IO.Streams.Internal (InputStream, OutputStream, makeInputStream, makeOutputStream, read)+ ------------------------------------------------------------------------------ -- | Writes the contents of an input stream to a channel until the input stream
src/System/IO/Streams/Core.hs view
@@ -39,5 +39,6 @@ , yield ) where +------------------------------------------------------------------------------ import Prelude () import System.IO.Streams.Internal
src/System/IO/Streams/Debug.hs view
@@ -12,10 +12,13 @@ , debugOutputBS ) where +------------------------------------------------------------------------------ import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as S+------------------------------------------------------------------------------ import System.IO.Streams.Internal (InputStream (..), OutputStream) import qualified System.IO.Streams.Internal as Streams+ ------------------------------------------------------------------------------ debugInput ::
src/System/IO/Streams/File.hs view
@@ -18,12 +18,9 @@ import Control.Monad (unless) import Data.ByteString (ByteString) import Data.Int (Int64)-import System.IO (BufferMode (NoBuffering),- IOMode (ReadMode, WriteMode),- SeekMode (AbsoluteSeek), hSeek,- hSetBuffering, withBinaryFile)+import System.IO (BufferMode (NoBuffering), IOMode (ReadMode, WriteMode), SeekMode (AbsoluteSeek), hSeek, hSetBuffering, withBinaryFile) -------------------------------------------------------------------------------import System.IO.Streams.Handle+import System.IO.Streams.Handle (handleToInputStream, handleToOutputStream) import System.IO.Streams.Internal (InputStream, OutputStream)
src/System/IO/Streams/Handle.hs view
@@ -20,6 +20,7 @@ , stderr ) where +------------------------------------------------------------------------------ import Data.ByteString (ByteString) import qualified Data.ByteString as S import qualified GHC.IO.Handle as H@@ -27,11 +28,7 @@ import qualified System.IO as IO import System.IO.Unsafe (unsafePerformIO) -------------------------------------------------------------------------------import System.IO.Streams.Internal (InputStream, OutputStream,- SP (..), lockingInputStream,- lockingOutputStream,- makeInputStream,- makeOutputStream)+import System.IO.Streams.Internal (InputStream, OutputStream, SP (..), lockingInputStream, lockingOutputStream, makeInputStream, makeOutputStream) ------------------------------------------------------------------------------
src/System/IO/Streams/Internal.hs view
@@ -117,7 +117,7 @@ -- * @'write' :: 'Maybe' c -> 'OutputStream' c -> 'IO' ()@ -- -- Values of type @c@ are written in an 'OutputStream' by wrapping them in--- 'Just', and the end of the stream is indicated by by supplying 'Nothing'.+-- 'Just', and the end of the stream is indicated by supplying 'Nothing'. -- -- If you supply a value after a 'Nothing', the behavior is defined by the -- implementer of the given 'OutputStream'. (All 'OutputStream' definitions in@@ -141,7 +141,7 @@ ------------------------------------------------------------------------------ -- | Feeds a value to an 'OutputStream'. Values of type @c@ are written in an -- 'OutputStream' by wrapping them in 'Just', and the end of the stream is--- indicated by by supplying 'Nothing'.+-- indicated by supplying 'Nothing'. -- write :: Maybe a -> OutputStream a -> IO () write = flip _write
src/System/IO/Streams/Internal/Attoparsec.hs view
@@ -15,8 +15,7 @@ ------------------------------------------------------------------------------ import Control.Exception (Exception, throwIO) import Control.Monad (when)-import Data.Attoparsec.ByteString.Char8 (Parser, Result,- eitherResult, feed, parse)+import Data.Attoparsec.ByteString.Char8 (Parser, Result, eitherResult, feed, parse) import Data.Attoparsec.Types (IResult (..)) import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as S@@ -25,6 +24,7 @@ ------------------------------------------------------------------------------ import System.IO.Streams.Internal (InputStream) import qualified System.IO.Streams.Internal as Streams+ ------------------------------------------------------------------------------ -- | An exception raised when parsing fails.
src/System/IO/Streams/Internal/Search.hs view
@@ -11,14 +11,15 @@ import Control.Monad.IO.Class (liftIO) import Data.ByteString.Char8 (ByteString) import qualified Data.ByteString.Char8 as S-import Data.ByteString.Unsafe as S+import qualified Data.ByteString.Unsafe as S import qualified Data.Vector.Unboxed as V import qualified Data.Vector.Unboxed.Mutable as MV-import Prelude hiding (last, read)+import Prelude (Bool (..), Either (..), Enum (..), Eq (..), IO, Int, Monad (..), Num (..), Ord (..), Show, either, id, maybe, not, otherwise, ($), ($!), (&&), (.), (||)) ------------------------------------------------------------------------------ import System.IO.Streams.Internal (InputStream) import qualified System.IO.Streams.Internal as Streams + ------------------------------------------------------------------------------ -- | 'MatchInfo' provides match information when performing string search. data MatchInfo = Match {-# UNPACK #-} !ByteString@@ -89,7 +90,7 @@ go !hidx | hend >= hlen = crossBound hidx | otherwise = do- let match = matches needle 0 last haystack hidx hend+ let match = matches needle 0 lastIdx haystack hidx hend if match then do let !nomatch = S.take hidx haystack@@ -120,7 +121,7 @@ where runNext !hidx !leftLen !needMore !nextHaystack = do- let match1 = matches needle leftLen last nextHaystack 0+ let match1 = matches needle leftLen lastIdx nextHaystack 0 (needMore-1) let match2 = matches needle 0 (leftLen-1) haystack hidx (hlen-1)@@ -165,8 +166,8 @@ startSearch aftermatch --------------------------------------------------------------------------- !nlen = S.length needle- !last = nlen - 1+ !nlen = S.length needle+ !lastIdx = nlen - 1 -------------------------------------------------------------------------- !table = V.create $ do@@ -176,10 +177,10 @@ where go !t = go' 0 where- go' !i | i >= last = return t- | otherwise = do+ go' !i | i >= lastIdx = return t+ | otherwise = do let c = fromEnum $ S.unsafeIndex needle i- MV.unsafeWrite t c (last - i)+ MV.unsafeWrite t c (lastIdx - i) go' $! i+1 --------------------------------------------------------------------------
src/System/IO/Streams/List.hs view
@@ -15,14 +15,13 @@ , listOutputStream ) where +------------------------------------------------------------------------------ import Control.Concurrent.MVar (modifyMVar, modifyMVar_, newMVar) import Control.Monad.IO.Class (MonadIO (..)) import Data.IORef (newIORef, readIORef, writeIORef) import Prelude hiding (read)-import System.IO.Streams.Internal (InputStream, OutputStream, await,- connect, fromConsumer,- fromGenerator, makeInputStream,- read, write, yield)+------------------------------------------------------------------------------+import System.IO.Streams.Internal (InputStream, OutputStream, await, connect, fromConsumer, fromGenerator, makeInputStream, read, write, yield) ------------------------------------------------------------------------------
src/System/IO/Streams/Network.hs view
@@ -10,15 +10,15 @@ ------------------------------------------------------------------------------ import Control.Exception (catch) import qualified Data.ByteString.Char8 as S-import Data.ByteString.Internal as S+import qualified Data.ByteString.Internal as S import Foreign.ForeignPtr (newForeignPtr, withForeignPtr) import Foreign.Marshal.Alloc (finalizerFree, mallocBytes) import Network.Socket (Socket) import qualified Network.Socket as N import qualified Network.Socket.ByteString as NB-import Prelude (IO, Int, Maybe (..), return,- ($!), (<=), (>>=))+import Prelude (IO, Int, Maybe (..), return, ($!), (<=), (>>=)) import System.IO.Error (ioError, isEOFError)+------------------------------------------------------------------------------ import System.IO.Streams.Internal (InputStream, OutputStream) import qualified System.IO.Streams.Internal as Streams @@ -33,7 +33,7 @@ -- as is usually the case in @io-streams@, writing a 'Nothing' to the generated -- 'OutputStream' does not cause the underlying 'Socket' to be closed. socketToStreams :: Socket- -> IO (InputStream ByteString, OutputStream ByteString)+ -> IO (InputStream S.ByteString, OutputStream S.ByteString) socketToStreams = socketToStreamsWithBufferSize bUFSIZ @@ -45,7 +45,7 @@ socketToStreamsWithBufferSize :: Int -- ^ how large the receive buffer should be -> Socket -- ^ network socket- -> IO (InputStream ByteString, OutputStream ByteString)+ -> IO (InputStream S.ByteString, OutputStream S.ByteString) socketToStreamsWithBufferSize bufsiz socket = do is <- Streams.makeInputStream input os <- Streams.makeOutputStream output
src/System/IO/Streams/Process.hs view
@@ -9,16 +9,14 @@ ------------------------------------------------------------------------------ import Data.ByteString.Char8 (ByteString) import System.IO (hClose)+import System.Process (CmdSpec (..), CreateProcess (CreateProcess, close_fds, cmdspec, create_group, cwd, std_err, std_in, std_out), ProcessHandle, StdStream (..), createProcess, getProcessExitCode, interruptProcessGroupOf, proc, rawSystem, readProcess, readProcessWithExitCode, runCommand, shell, showCommandForUser, system, terminateProcess, waitForProcess)+------------------------------------------------------------------------------ import qualified System.IO.Streams.Combinators as Streams import qualified System.IO.Streams.Handle as Streams import System.IO.Streams.Internal (InputStream, OutputStream) import qualified System.IO.Streams.Internal as Streams-import System.Process hiding (env,- runInteractiveCommand,- runInteractiveProcess,- runProcess)+ import qualified System.Process as P------------------------------------------------------------------------------- ------------------------------------------------------------------------------
src/System/IO/Streams/Vector.hs view
@@ -26,19 +26,16 @@ ) where -------------------------------------------------------------------------------import Control.Concurrent.MVar (modifyMVar, modifyMVar_,- newMVar)+import Control.Concurrent.MVar (modifyMVar, modifyMVar_, newMVar) import Control.Monad (liftM, (>=>)) import Control.Monad.IO.Class (MonadIO (..)) import Control.Monad.Primitive (PrimState (..))-import Data.IORef (IORef, newIORef, readIORef,- writeIORef)+import Data.IORef (IORef, newIORef, readIORef, writeIORef) import Data.Vector.Generic (Vector (..)) import qualified Data.Vector.Generic as V import Data.Vector.Generic.Mutable (MVector) import qualified Data.Vector.Generic.Mutable as VM-import System.IO.Streams.Internal (InputStream, OutputStream,- fromGenerator, yield)+import System.IO.Streams.Internal (InputStream, OutputStream, fromGenerator, yield) import qualified System.IO.Streams.Internal as S
src/System/IO/Streams/Zlib.hs view
@@ -18,38 +18,18 @@ ) where -------------------------------------------------------------------------------import Blaze.ByteString.Builder (fromByteString)--------------------------------------------------------------------------------import Blaze.ByteString.Builder.Internal (Builder,- defaultBufferSize,- flush)--------------------------------------------------------------------------------import Blaze.ByteString.Builder.Internal.Buffer (allocBuffer)--------------------------------------------------------------------------------import Codec.Zlib (Deflate, Inflate,- Popper,- WindowBits (..),- feedDeflate,- feedInflate,- finishDeflate,- finishInflate,- flushDeflate,- flushInflate,- initDeflate,- initInflate)------------------------------------------------------------------------------- import Data.ByteString (ByteString) import qualified Data.ByteString as S-import Data.IORef (newIORef, readIORef,- writeIORef)+import Data.IORef (newIORef, readIORef, writeIORef) import Prelude hiding (read) ------------------------------------------------------------------------------+import Blaze.ByteString.Builder (fromByteString)+import Blaze.ByteString.Builder.Internal (Builder, defaultBufferSize, flush)+import Blaze.ByteString.Builder.Internal.Buffer (allocBuffer)+import Codec.Zlib (Deflate, Inflate, Popper, WindowBits (..), feedDeflate, feedInflate, finishDeflate, finishInflate, flushDeflate, flushInflate, initDeflate, initInflate)+------------------------------------------------------------------------------ import System.IO.Streams.Builder (unsafeBuilderStream)-import System.IO.Streams.Internal (InputStream,- OutputStream,- makeInputStream,- makeOutputStream,- read, write)+import System.IO.Streams.Internal (InputStream, OutputStream, makeInputStream, makeOutputStream, read, write) ------------------------------------------------------------------------------