blaze-builder-conduit 0.5.0.2 → 0.5.0.3
raw patch · 2 files changed
+20/−13 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Data/Conduit/Blaze.hs +19/−12
- blaze-builder-conduit.cabal +1/−1
Data/Conduit/Blaze.hs view
@@ -43,8 +43,8 @@ ) where import Data.Conduit hiding (Source, Conduit, Sink, Pipe)-import Control.Monad (unless)-import Control.Monad.Trans.Class (lift)+import Control.Monad (unless, liftM)+import Control.Monad.Trans.Class (lift, MonadTrans) import qualified Data.ByteString as S @@ -86,10 +86,10 @@ => BufferAllocStrategy -> GInfConduit Builder m S.ByteString builderToByteStringWith =- mapOutputMaybe unChunk . mapInput Chunk unChunk . builderToByteStringWithFlush+ helper (liftM (fmap Chunk) awaitE) yield' where- unChunk Flush = Nothing- unChunk (Chunk y) = Just y+ yield' Flush = return ()+ yield' (Chunk bs) = yield bs -- | --@@ -98,18 +98,25 @@ :: MonadUnsafeIO m => BufferAllocStrategy -> GInfConduit (Flush Builder) m (Flush S.ByteString)-builderToByteStringWithFlush (ioBufInit, nextBuf) =+builderToByteStringWithFlush = helper awaitE yield++helper :: (MonadUnsafeIO m, Monad (t m), MonadTrans t)+ => t m (Either term (Flush Builder))+ -> (Flush S.ByteString -> t m ())+ -> BufferAllocStrategy+ -> t m term+helper awaitE' yield' (ioBufInit, nextBuf) = loop ioBufInit where loop ioBuf = do- awaitE >>= either (close ioBuf) (cont' ioBuf)+ awaitE' >>= either (close ioBuf) (cont' ioBuf) - cont' ioBuf Flush = push ioBuf flush $ \ioBuf' -> yield Flush >> loop ioBuf'+ cont' ioBuf Flush = push ioBuf flush $ \ioBuf' -> yield' Flush >> loop ioBuf' cont' ioBuf (Chunk builder) = push ioBuf builder loop close ioBuf r = do buf <- lift $ unsafeLiftIO $ ioBuf- maybe (return ()) (yield . Chunk) (unsafeFreezeNonEmptyBuffer buf)+ maybe (return ()) (yield' . Chunk) (unsafeFreezeNonEmptyBuffer buf) return r push ioBuf0 x continue = do@@ -133,12 +140,12 @@ go bStep' ioBuf' case unsafeFreezeNonEmptyBuffer buf' of Nothing -> return ()- Just bs -> yield (Chunk bs)+ Just bs -> yield' (Chunk bs) cont InsertByteString op' bs bStep' -> do let buf' = updateEndOfSlice buf op' case unsafeFreezeNonEmptyBuffer buf' of Nothing -> return ()- Just bs' -> yield $ Chunk bs'- unless (S.null bs) $ yield $ Chunk bs+ Just bs' -> yield' $ Chunk bs'+ unless (S.null bs) $ yield' $ Chunk bs lift (unsafeLiftIO $ nextBuf 1 buf') >>= go bStep'
blaze-builder-conduit.cabal view
@@ -1,5 +1,5 @@ Name: blaze-builder-conduit-Version: 0.5.0.2+Version: 0.5.0.3 Synopsis: Convert streams of builders to streams of bytestrings. Description: Convert streams of builders to streams of bytestrings. License: BSD3