decoder-conduit 0.0.1.0 → 0.0.1.1
raw patch · 2 files changed
+10/−11 lines, 2 files
Files
- Data/Conduit/Decoder.hs +8/−9
- decoder-conduit.cabal +2/−2
Data/Conduit/Decoder.hs view
@@ -21,15 +21,14 @@ -- | Incrementally reads ByteStrings and builds from supplied Get monad. -- Will throw an exception if there was an error parsing conduitDecoder :: MonadThrow m => Get a -> Conduit ByteString m a-conduitDecoder decoderGet = incrementalDecode emptyGet- where emptyGet = runGetIncremental decoderGet+conduitDecoder decoderGet = incrementalDecode emptyDecoder+ where emptyDecoder = runGetIncremental decoderGet incrementalDecode built = await >>= maybe (return ()) handleConvert- where handleConvert msg = do- let newMsg = pushChunk built msg- case newMsg of- Done a n doc -> do yield doc- incrementalDecode $ pushChunk emptyGet a- Partial _ -> incrementalDecode newMsg+ where handleConvert bytestringInput = do+ case pushChunk built bytestringInput of+ Done a n doc -> do yield doc+ incrementalDecode $ pushChunk emptyDecoder a+ curBS@(Partial _) -> incrementalDecode curBS Fail a _ err -> do monadThrow $ BinaryDecodeException err- incrementalDecode $ pushChunk emptyGet a+ incrementalDecode $ pushChunk emptyDecoder a
decoder-conduit.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.0.1.0+version: 0.0.1.1 -- A short (one-line) description of the package. synopsis: Conduit for decoding ByteStrings using Data.Binary.Get@@ -37,7 +37,7 @@ -- A copyright notice. -- copyright: -category: Data+category: Conduit build-type: Simple