blaze-builder 0.4.1.0 → 0.4.2.1
raw patch · 3 files changed
+34/−14 lines, 3 filesdep ~basedep ~bytestringdep ~semigroupsPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, bytestring, semigroups
API changes (from Hackage documentation)
Files
- Blaze/ByteString/Builder.hs +17/−5
- CHANGES +8/−0
- blaze-builder.cabal +9/−9
Blaze/ByteString/Builder.hs view
@@ -120,15 +120,27 @@ unsafeDupablePerformIO = unsafePerformIO #endif +withBS :: S.ByteString -> (ForeignPtr Word8 -> Int -> Int -> a) -> a+#if MIN_VERSION_bytestring(0,11,0)+withBS (S.BS fptr len) f = f fptr 0 len+#else+withBS (S.PS fptr offset len) f = f fptr offset len+#endif +mkBS :: ForeignPtr Word8 -> Int -> S.ByteString+#if MIN_VERSION_bytestring(0,11,0)+mkBS fptr len = S.BS fptr len+#else+mkBS fptr len = S.PS fptr 0 len+#endif -- | Pack the chunks of a lazy bytestring into a single strict bytestring. packChunks :: L.ByteString -> S.ByteString packChunks lbs = do S.unsafeCreate (fromIntegral $ L.length lbs) (copyChunks lbs) where- copyChunks !L.Empty !_pf = return ()- copyChunks !(L.Chunk (S.PS fpbuf o l) lbs') !pf = do+ copyChunks !L.Empty !_pf = return ()+ copyChunks !(L.Chunk bs lbs') !pf = withBS bs $ \fpbuf o l -> do withForeignPtr fpbuf $ \pbuf -> copyBytes pf (pbuf `plusPtr` o) l copyChunks lbs' (pf `plusPtr` l)@@ -188,15 +200,15 @@ let !ptr = Unsafe.unsafeForeignPtrToPtr fp (bytes, next) <- writer ptr size case next of- B.Done -> io $! S.PS fp 0 bytes+ B.Done -> io $! mkBS fp bytes B.More req writer' -> do- io $! S.PS fp 0 bytes+ io $! mkBS fp bytes let !size' = max bufSize req S.mallocByteString size' >>= getBuffer writer' size' B.Chunk bs' writer' -> do if bytes > 0 then do- io $! S.PS fp 0 bytes+ io $! mkBS fp bytes unless (S.null bs') (io bs') S.mallocByteString bufSize >>= getBuffer writer' bufSize else do
CHANGES view
@@ -1,3 +1,11 @@+* 0.4.2.1+ - Bump cabal file to Cabal >= 1.10++* 0.4.2.0+ - Make semigroup instances unconditional+ - Support bytestring-0.11+ - Support semigroups-0.19+ * 0.4.1.0 - Gain compatibility with the Semigroup/Monoid proposal - Add Word8 HTML escaping builders
blaze-builder.cabal view
@@ -1,5 +1,5 @@ Name: blaze-builder-Version: 0.4.1.0+Version: 0.4.2.1 Synopsis: Efficient buffered output. Description:@@ -34,7 +34,7 @@ Category: Data Build-type: Simple-Cabal-version: >= 1.8+Cabal-version: >= 1.10 Extra-source-files: Makefile@@ -55,6 +55,7 @@ Library ghc-options: -Wall+ default-language: Haskell98 exposed-modules: Blaze.ByteString.Builder Blaze.ByteString.Builder.Int@@ -80,15 +81,14 @@ build-depends: bytestring >= 0.10.4 && < 1.0 if impl(ghc < 8.0)- build-depends: semigroups >= 0.16 && < 0.19+ build-depends: semigroups >= 0.16 && < 0.20 test-suite test- type: exitcode-stdio-1.0-- hs-source-dirs: tests- main-is: Tests.hs-- ghc-options: -Wall -fno-warn-orphans+ type: exitcode-stdio-1.0+ hs-source-dirs: tests+ main-is: Tests.hs+ default-language: Haskell98+ ghc-options: -Wall -fno-warn-orphans build-depends: base , blaze-builder