conduit-algorithms 0.0.7.1 → 0.0.7.2
raw patch · 5 files changed
+29/−13 lines, 5 filesdep +streaming-commonsdep ~conduit
Dependencies added: streaming-commons
Dependency ranges changed: conduit
Files
- ChangeLog +3/−0
- Data/Conduit/Algorithms/Async.hs +7/−4
- Data/Conduit/Algorithms/Async/ByteString.hs +11/−3
- Data/Conduit/Algorithms/Storable.hs +2/−2
- conduit-algorithms.cabal +6/−4
ChangeLog view
@@ -1,3 +1,6 @@+Version 0.0.7.2 2018-02-19 by luispedro+ * Add handle information to error message to Handle in asyncGzipFrom+ Version 0.0.7.1 2018-01-18 by luispedro * Fix testing in newer stack/cabal/hpack (issue #3)
Data/Conduit/Algorithms/Async.hs view
@@ -31,6 +31,7 @@ import qualified Data.Conduit.List as CL import qualified Data.Conduit.Zlib as CZ import qualified Data.Conduit.Lzma as CX+import qualified Data.Streaming.Zlib as SZ #ifndef WINDOWS -- bzlib cannot compile on Windows (as of 2016/07/05) import qualified Data.Conduit.BZlib as CZ@@ -45,8 +46,9 @@ import Control.Monad.IO.Class (MonadIO, liftIO) import Control.Monad.Error.Class (MonadError(..)) import Control.Monad.Trans.Resource (MonadResource, MonadBaseControl)-import Control.Exception (evaluate)-import Control.DeepSeq+import Control.Exception (evaluate, displayException)+import Control.DeepSeq (NFData, force)+import System.IO.Error (mkIOError, userErrorType) import System.IO import Data.List (isSuffixOf) import Data.Conduit.Algorithms.Utils (awaitJust)@@ -213,8 +215,9 @@ .| CL.map Just .| CA.sinkTBQueue q atomically (TQ.writeTBQueue q Nothing)- CA.gatherFrom 8 prod- .| untilNothing+ (CA.gatherFrom 8 prod .| untilNothing)+ `C.catchC`+ (\(e :: SZ.ZlibException) -> liftIO . ioError $ mkIOError userErrorType ("Error reading gzip file: "++displayException e) (Just h) Nothing) -- | Open and read a gzip file with the uncompression being performed in a -- separate thread.
Data/Conduit/Algorithms/Async/ByteString.hs view
@@ -4,7 +4,7 @@ License : MIT Maintainer : luis@luispedro.org -Higher level async processing interfaces.+Higher level async processing interfaces for handling 'ByteString' objects. -} {-# LANGUAGE ScopedTypeVariables, FlexibleContexts, TupleSections #-} @@ -42,8 +42,8 @@ -- perform most of the line splitting _in the worker thread_. -- -- Only Unix-style ASCII lines are supported (splitting at Bytes with value--- 10, i.e., \n). When Windows lines (\r\n) are passed to this function, this--- results in each element having an extra \r at the end.+-- 10, i.e., \\n). When Windows lines (\\r\\n) are passed to this function, this+-- results in each element having an extra \\r at the end. asyncMapLineGroupsC :: (MonadIO m, NFData a) => Int -> ([B.ByteString] -> a) -> C.Conduit B.ByteString m a asyncMapLineGroupsC nthreads f = breakAtLineBoundary .| CAlg.asyncMapC nthreads (f . asLines) where@@ -64,6 +64,14 @@ continue (BL.fromStrict $ B.drop 1 rest) -- skip \n char -- | Filter lines using multiple threads+--+-- It is not clear from the types but the input is taken to unbroken lines,+-- while the output will be yielded line by line. This conduit is equivalent to+--+-- @+-- CB.lines .| CL.filer f+-- @+-- asyncFilterLinesC :: MonadIO m => Int -> (B.ByteString -> Bool) -> C.Conduit B.ByteString m B.ByteString asyncFilterLinesC n f = asyncMapLineGroupsC n (filter f) .| CL.concat {-# INLINE asyncFilterLinesC #-}
Data/Conduit/Algorithms/Storable.hs view
@@ -32,7 +32,7 @@ -- -- This uses the same format as in-memory ----- See |readStorableV|+-- See 'readStorableV' writeStorableV :: forall m a. (MonadIO m, Monad m, Storable a) => C.Conduit (VS.Vector a) m B.ByteString writeStorableV = CL.mapM (liftIO. encodeStorable') where@@ -45,7 +45,7 @@ -- -- This expects the same format as the in-memory vector ----- See |writeStorableV|+-- See 'writeStorableV' readStorableV :: forall m a. (MonadIO m, Storable a) => Int -> C.ConduitM B.ByteString (VS.Vector a) m () readStorableV nelems = CC.chunksOfE blockBytes .| parseBlocks where
conduit-algorithms.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: af773895c6365b46822705a9fd57b521ba0e8692c5053f7a6eba56b6cc57b07b+-- hash: d2ff0dcb74b83abcf9bd574764e0d2acf0134cba6ae1d4a221fe6abf3d90b2ea name: conduit-algorithms-version: 0.0.7.1+version: 0.0.7.2 synopsis: Conduit-based algorithms description: Algorithms on Conduits, including higher level asynchronous processing and some other utilities. category: Conduit@@ -34,7 +34,7 @@ , base >4.8 && <5 , bytestring , bzlib-conduit- , conduit >=1.0+ , conduit >=1.0.11 , conduit-combinators >=1.1.2 , conduit-extra , containers@@ -44,6 +44,7 @@ , resourcet , stm , stm-conduit >=2.7+ , streaming-commons , transformers , vector exposed-modules:@@ -67,7 +68,7 @@ , base >4.8 && <5 , bytestring , bzlib-conduit- , conduit >=1.0+ , conduit >=1.0.11 , conduit-algorithms , conduit-combinators >=1.1.2 , conduit-extra@@ -79,6 +80,7 @@ , resourcet , stm , stm-conduit >=2.7+ , streaming-commons , test-framework , test-framework-hunit , test-framework-th