conduit 1.0.7.1 → 1.0.7.2
raw patch · 2 files changed
+22/−21 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- Data/Conduit/Text.hs +21/−20
- conduit.cabal +1/−1
Data/Conduit/Text.hs view
@@ -204,32 +204,33 @@ utf8 = Codec name enc dec where name = T.pack "UTF-8" enc text = (TE.encodeUtf8 text, Nothing)- dec bytes = case splitQuickly bytes of+ dec bytes = case splitQuickly bytes >>= maybeDecode of Just (text, extra) -> (text, Right extra) Nothing -> splitSlowly TE.decodeUtf8 bytes - splitQuickly bytes = loop 0 >>= maybeDecode where- required x0- | x0 .&. 0x80 == 0x00 = 1- | x0 .&. 0xE0 == 0xC0 = 2- | x0 .&. 0xF0 == 0xE0 = 3- | x0 .&. 0xF8 == 0xF0 = 4+ -- Whether the given byte is a continuation byte.+ isContinuation byte = byte .&. 0xC0 == 0x80 - -- Invalid input; let Text figure it out- | otherwise = 0+ -- The number of continuation bytes needed by the given+ -- non-continuation byte.+ required x0+ | x0 .&. 0x80 == 0x00 = 0+ | x0 .&. 0xE0 == 0xC0 = 1+ | x0 .&. 0xF0 == 0xE0 = 2+ | x0 .&. 0xF8 == 0xF0 = 3+ | otherwise = err - maxN = B.length bytes+ err = error "Data.Conduit.Text.utf8: expected non-continuation byte" - loop n | n == maxN = Just (TE.decodeUtf8 bytes, B.empty)- loop n = let- req = required (B.index bytes n)- tooLong = first TE.decodeUtf8 (B.splitAt n bytes)- decodeMore = loop $! n + req- in if req == 0- then Nothing- else if n + req > maxN- then Just tooLong- else decodeMore+ splitQuickly bytes+ | B.null l = Nothing+ | req == B.length r = Just (TE.decodeUtf8 bytes, B.empty)+ | otherwise = Just (TE.decodeUtf8 l', r')+ where+ (l, r) = B.spanEnd isContinuation bytes+ req = required (B.last l)+ l' = B.init l+ r' = B.cons (B.last l) r -- | -- Since 0.3.0
conduit.cabal view
@@ -1,5 +1,5 @@ Name: conduit-Version: 1.0.7.1+Version: 1.0.7.2 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>.