packages feed

cereal-conduit 0.7.1 → 0.7.2

raw patch · 4 files changed

+15/−5 lines, 4 filesdep ~cereal

Dependency ranges changed: cereal

Files

Data/Conduit/Cereal.hs view
@@ -45,7 +45,10 @@ sinkGet :: C.MonadThrow m => Get r -> C.Consumer BS.ByteString m r sinkGet = mkSinkGet errorHandler terminationHandler   where errorHandler msg = pipeError $ GetException msg-        terminationHandler f = let Fail msg = f BS.empty in pipeError $ GetException msg +        terminationHandler f = case f BS.empty of+          Fail msg _ -> pipeError $ GetException msg+          Done r lo -> C.leftover lo >> return r+          Partial _ -> pipeError $ GetException "Failed reading: Internal error: unexpected Partial."  pipeError :: (C.MonadThrow m, MonadTrans t, Exception e) => e -> t m a pipeError e = lift $ C.monadThrow e
Data/Conduit/Cereal/Internal.hs view
@@ -32,7 +32,7 @@           | BS.null s = C.await >>= maybe (when (not $ null b) (C.leftover $ BS.concat $ reverse b)) (pull f b)           | otherwise = consume False f b s         consume initial f b s = case f s of-          Fail msg  -> do+          Fail msg _ -> do             when (not $ null b) (C.leftover $ BS.concat $ reverse consumed)             errorHandler msg           Partial p -> pull p consumed BS.empty@@ -56,7 +56,7 @@                           Just a -> pull f b a           | otherwise = consume f b s         consume f b s = case f s of-          Fail msg  -> do+          Fail msg _ -> do             when (not $ null b) (C.leftover $ BS.concat $ reverse consumed)             errorHandler msg           Partial p -> pull p consumed BS.empty
Test/Main.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE Rank2Types #-} +import           Control.Applicative (many) import           Control.Exception.Base import           Control.Monad.Identity import           Control.Monad.Trans.Resource@@ -100,6 +101,11 @@     output' <- CL.consume     return (output, BS.concat output')))) +sinktest9 :: Test+sinktest9 = TestCase (assertEqual "Properly terminate Partials"+  (Right [0..255])+  (runIdentity $ runExceptionT $ mapM_ (C.yield . BS.singleton) [0..255] C.$$ sinkGet (many getWord8)))+ conduittest1 :: Test conduittest1 = TestCase (assertEqual "Handles starting with empty bytestring"   (Right [])@@ -230,6 +236,7 @@                      , sinktest6                      , sinktest7                      , sinktest8+                     , sinktest9                      ]  conduittests = TestList [ conduittest1
cereal-conduit.cabal view
@@ -1,5 +1,5 @@ name:            cereal-conduit-version:         0.7.1+version:         0.7.2 license:         BSD3 license-file:    LICENSE author:          Myles C. Maxfield <myles.maxfield@gmail.com>@@ -20,7 +20,7 @@ library     build-depends: base         >= 4       && < 5                  , conduit      >= 1.0.0   && < 1.1-                 , cereal       >= 0.3.1.0+                 , cereal       >= 0.4.0.0 && < 0.5                  , bytestring                  , transformers >= 0.2.0.0     exposed-modules: Data.Conduit.Cereal