packages feed

blaze-builder 0.3.3.3 → 0.3.3.4

raw patch · 4 files changed

+13/−10 lines, 4 filesdep ~basePVP: minor bump suggested

API additions: PVP suggests at least a minor version bump

Dependency ranges changed: base

API changes (from Hackage documentation)

+ Blaze.ByteString.Builder.Internal.Types: instance Applicative Put

Files

Blaze/ByteString/Builder/Internal.hs view
@@ -63,7 +63,11 @@ #endif  import Control.Monad (unless)+#if MIN_VERSION_base(4,4,0) import System.IO.Unsafe (unsafeDupablePerformIO)+#else+import System.IO.Unsafe (unsafePerformIO)+#endif  import qualified Data.ByteString               as S import qualified Data.ByteString.Internal      as S@@ -359,11 +363,18 @@ toByteStringIO = toByteStringIOWith defaultBufferSize {-# INLINE toByteStringIO #-} +unsafeIO :: IO a -> a+#if MIN_VERSION_base(4,4,0)+unsafeIO = unsafeDupablePerformIO+#else+unsafeIO = unsafePerformIO+#endif+ -- | Run a 'Write' to produce a strict 'S.ByteString'. -- This is equivalent to @('toByteString' . 'fromWrite')@, but is more -- efficient because it uses just one appropriately-sized buffer. writeToByteString :: Write -> S.ByteString-writeToByteString !w = unsafeDupablePerformIO $ do+writeToByteString !w = unsafeIO $ do     fptr <- S.mallocByteString (getBound w)     len <- withForeignPtr fptr $ \ptr -> do         end <- runWrite w ptr
Blaze/ByteString/Builder/Internal/Types.hs view
@@ -19,9 +19,7 @@ -- module Blaze.ByteString.Builder.Internal.Types where -#ifdef APPLICATIVE_IN_BASE import Control.Applicative-#endif  import Data.Monoid import qualified Data.ByteString      as S@@ -86,7 +84,6 @@   fmap f (Put put) = Put $ \k -> put (\x -> k (f x))   {-# INLINE fmap #-} -#ifdef APPLICATIVE_IN_BASE instance Applicative Put where   pure x = Put $ \k -> k x   {-# INLINE pure #-}@@ -96,7 +93,6 @@   {-# INLINE (<*) #-}   a *> b = Put $ \k -> unPut a (\_ -> unPut b k)   {-# INLINE (*>) #-}-#endif  instance Monad Put where   return x = Put $ \k -> k x
benchmarks/Throughput/BlazePutMonad.hs view
@@ -59,9 +59,7 @@ import qualified Data.ByteString      as S import qualified Data.ByteString.Lazy as L -#ifdef APPLICATIVE_IN_BASE import Control.Applicative-#endif   ------------------------------------------------------------------------@@ -82,14 +80,12 @@         fmap f m = Put $ let PairS a w = unPut m in PairS (f a) w         {-# INLINE fmap #-} -#ifdef APPLICATIVE_IN_BASE instance Applicative PutM where         pure    = return         m <*> k = Put $             let PairS f w  = unPut m                 PairS x w' = unPut k             in PairS (f x) (w `mappend` w')-#endif  -- Standard Writer monad, with aggressive inlining instance Monad PutM where
blaze-builder.cabal view
@@ -1,5 +1,5 @@ Name:                blaze-builder-Version:             0.3.3.3+Version:             0.3.3.4 Synopsis:            Efficient buffered output.  Description: