packages feed

conduit 1.0.11.1 → 1.0.12

raw patch · 4 files changed

+38/−23 lines, 4 files

Files

Data/Conduit/Binary.hs view
@@ -10,6 +10,7 @@       -- ** Sources       sourceFile     , sourceHandle+    , sourceHandleUnsafe     , sourceIOHandle     , sourceFileRange     , sourceHandleRange@@ -43,7 +44,7 @@ import Data.Conduit import Data.Conduit.List (sourceList, consume) import Control.Exception (assert, finally)-import Control.Monad (unless)+import Control.Monad (unless, when) import Control.Monad.IO.Class (liftIO, MonadIO) import Control.Monad.Trans.Resource (allocate, release) import Control.Monad.Trans.Class (lift)@@ -62,6 +63,7 @@ import Foreign.ForeignPtr (touchForeignPtr) import Foreign.Ptr (plusPtr) import Foreign.Storable (peek)+import GHC.ForeignPtr           (mallocPlainForeignPtrBytes)  -- | Stream the contents of a file as binary data. --@@ -97,6 +99,31 @@         if S.null bs             then return ()             else yield bs >> loop++-- | Same as @sourceHandle@, but instead of allocating a new buffer for each+-- incoming chunk of data, reuses the same buffer. Therefore, the @ByteString@s+-- yielded by this function are not referentially transparent between two+-- different @yield@s.+--+-- This function will be slightly more efficient than @sourceHandle@ by+-- avoiding allocations and reducing garbage collections, but should only be+-- used if you can guarantee that you do not reuse a @ByteString@ (or any slice+-- thereof) between two calls to @await@.+--+-- Since 1.0.12+sourceHandleUnsafe :: MonadIO m => IO.Handle -> Source m ByteString+sourceHandleUnsafe handle = do+    fptr <- liftIO $ mallocPlainForeignPtrBytes defaultChunkSize+    let ptr = unsafeForeignPtrToPtr fptr+        loop = do+            count <- liftIO $ IO.hGetBuf handle ptr defaultChunkSize+            when (count > 0) $ do+                yield (PS fptr 0 count)+                loop++    loop++    liftIO $ touchForeignPtr fptr  -- | An alternative to 'sourceHandle'. -- Instead of taking a pre-opened 'IO.Handle', it takes an action that opens
Data/Conduit/Internal.hs view
@@ -805,8 +805,8 @@ -- the @Sink@ uses @catchC@, the exception will /not/ be caught. -- -- Due to this behavior (as well as lack of async exception handling), you--- should not try to implement combinators such @onException@ in terms of this--- primitive.+-- should not try to implement combinators such as @onException@ in terms of this+-- primitive function. -- -- Note also that the exception handling will /not/ be applied to any -- finalizers generated by this conduit.
Data/Conduit/Lift.hs view
@@ -1,23 +1,11 @@ {-# LANGUAGE RankNTypes #-}-{- | Allow monad transformers to be run/eval/exec in a section of conduit- rather then needing to run across the whole conduit.-The circumvents many of the problems with breaking the monad transformer laws.-Read more about when the monad transformer laws are broken:-<https://github.com/snoyberg/conduit/wiki/Dealing-with-monad-transformers>--This method has a considerable number of advantages over the other two -recommended methods.--* Run the monad transformer outisde of the conduit-* Use a mutable varible inside a readerT to retain side effects.--This functionality has existed for awhile in the pipes ecosystem and my recent-improvement to the Pipes.Lift module has allowed it to almost mechanically -translated for conduit.---}--+-- | Allow monad transformers to be run/eval/exec in a section of conduit+-- rather then needing to run across the whole conduit.  The circumvents many+-- of the problems with breaking the monad transformer laws.  For more+-- information, see the announcement blog post:+-- <http://www.yesodweb.com/blog/2014/01/conduit-transformer-exception>+--+-- This module was added in conduit 1.0.11. module Data.Conduit.Lift (     -- * ErrorT     errorC,
conduit.cabal view
@@ -1,5 +1,5 @@ Name:                conduit-Version:             1.0.11.1+Version:             1.0.12 Synopsis:            Streaming data processing library. Description:     @conduit@ is a solution to the streaming data problem, allowing for production, transformation, and consumption of streams of data in constant memory. It is an alternative to lazy I\/O which guarantees deterministic resource handling, and fits in the same general solution space as @enumerator@\/@iteratee@ and @pipes@. For a tutorial, please visit <https://haskell.fpcomplete.com/user/snoyberg/library-documentation/conduit-overview>.