bytestring-builder 0.10.6.0.0 → 0.10.8.1.0
raw patch · 6 files changed
+41/−31 lines, 6 files
Files
- bytestring-builder.cabal +2/−2
- src/Data/ByteString/Builder/ASCII.hs +2/−2
- src/Data/ByteString/Builder/Internal.hs +16/−7
- src/Data/ByteString/Builder/Prim/Binary.hs +6/−6
- src/Data/ByteString/Builder/Prim/Internal/UncheckedShifts.hs +3/−10
- src/Data/ByteString/Short/Internal.hs +12/−4
bytestring-builder.cabal view
@@ -1,5 +1,5 @@ name: bytestring-builder-version: 0.10.6.0.0+version: 0.10.8.1.0 synopsis: The new bytestring builder, packaged outside of GHC description: This is the bytestring builder that is debuting in bytestring-0.10.4.0, which@@ -51,7 +51,7 @@ source-repository this type: git location: http://github.com/lpsmith/bytestring-builder- tag: v0.10.6.0.0+ tag: v0.10.8.1.0 Flag bytestring_has_builder default: True
src/Data/ByteString/Builder/ASCII.hs view
@@ -85,7 +85,7 @@ import Foreign -#if defined(__GLASGOW_HASKELL__) && defined(INTEGER_GMP)+#if defined(INTEGER_GMP) #if !(MIN_VERSION_base(4,8,0)) import Data.Monoid (mappend)@@ -304,7 +304,7 @@ -- Fast decimal 'Integer' encoding. ------------------------------------------------------------------------------ -#if defined(__GLASGOW_HASKELL__) && defined(INTEGER_GMP)+#if defined(INTEGER_GMP) -- An optimized version of the integer serialization code -- in blaze-textual (c) 2011 MailRank, Inc. Bryan O'Sullivan -- <bos@mailrank.com>. It is 2.5x faster on Int-sized integers and 4.5x faster
src/Data/ByteString/Builder/Internal.hs view
@@ -130,11 +130,13 @@ import Control.Arrow (second) +#if MIN_VERSION_base(4,9,0)+import Data.Semigroup (Semigroup((<>)))+#endif #if !(MIN_VERSION_base(4,8,0)) import Data.Monoid-import Control.Applicative (Applicative(..))+import Control.Applicative (Applicative(..),(<$>)) #endif-import Control.Applicative ((<$>)) import qualified Data.ByteString as S import qualified Data.ByteString.Internal as S@@ -400,11 +402,21 @@ append :: Builder -> Builder -> Builder append (Builder b1) (Builder b2) = Builder $ b1 . b2 +#if MIN_VERSION_base(4,9,0)+instance Semigroup Builder where+ {-# INLINE (<>) #-}+ (<>) = append+#endif+ instance Monoid Builder where {-# INLINE mempty #-} mempty = empty {-# INLINE mappend #-}+#if MIN_VERSION_base(4,9,0)+ mappend = (<>)+#else mappend = append+#endif {-# INLINE mconcat #-} mconcat = foldr mappend mempty @@ -490,21 +502,18 @@ pure x = Put $ \k -> k x {-# INLINE (<*>) #-} Put f <*> Put a = Put $ \k -> f (\f' -> a (\a' -> k (f' a')))-#if MIN_VERSION_base(4,2,0) {-# INLINE (<*) #-} (<*) = ap_l {-# INLINE (*>) #-} (*>) = ap_r-#endif instance Monad Put where {-# INLINE return #-}- return x = Put $ \k -> k x+ return = pure {-# INLINE (>>=) #-} Put m >>= f = Put $ \k -> m (\m' -> unPut (f m') k) {-# INLINE (>>) #-}- (>>) = ap_r-+ (>>) = (*>) -- Conversion between Put and Builder -------------------------------------
src/Data/ByteString/Builder/Prim/Binary.hs view
@@ -83,7 +83,7 @@ -- | Encoding 'Word16's in big endian format. {-# INLINE word16BE #-} word16BE :: FixedPrim Word16-#ifdef WORD_BIGENDIAN+#ifdef WORDS_BIGENDIAN word16BE = word16Host #else word16BE = fixedPrim 2 $ \w p -> do@@ -94,7 +94,7 @@ -- | Encoding 'Word16's in little endian format. {-# INLINE word16LE #-} word16LE :: FixedPrim Word16-#ifdef WORD_BIGENDIAN+#ifdef WORDS_BIGENDIAN word16LE = fixedPrim 2 $ \w p -> do poke p (fromIntegral (w) :: Word8) poke (p `plusPtr` 1) (fromIntegral (shiftr_w16 w 8) :: Word8)@@ -105,7 +105,7 @@ -- | Encoding 'Word32's in big endian format. {-# INLINE word32BE #-} word32BE :: FixedPrim Word32-#ifdef WORD_BIGENDIAN+#ifdef WORDS_BIGENDIAN word32BE = word32Host #else word32BE = fixedPrim 4 $ \w p -> do@@ -118,7 +118,7 @@ -- | Encoding 'Word32's in little endian format. {-# INLINE word32LE #-} word32LE :: FixedPrim Word32-#ifdef WORD_BIGENDIAN+#ifdef WORDS_BIGENDIAN word32LE = fixedPrim 4 $ \w p -> do poke p (fromIntegral (w) :: Word8) poke (p `plusPtr` 1) (fromIntegral (shiftr_w32 w 8) :: Word8)@@ -134,7 +134,7 @@ -- | Encoding 'Word64's in big endian format. {-# INLINE word64BE #-} word64BE :: FixedPrim Word64-#ifdef WORD_BIGENDIAN+#ifdef WORDS_BIGENDIAN word64BE = word64Host #else #if WORD_SIZE_IN_BITS < 64@@ -170,7 +170,7 @@ -- | Encoding 'Word64's in little endian format. {-# INLINE word64LE #-} word64LE :: FixedPrim Word64-#ifdef WORD_BIGENDIAN+#ifdef WORDS_BIGENDIAN #if WORD_SIZE_IN_BITS < 64 word64LE = fixedPrim 8 $ \w p -> do
src/Data/ByteString/Builder/Prim/Internal/UncheckedShifts.hs view
@@ -18,7 +18,7 @@ -- These functions are undefined when the amount being shifted by is -- greater than the size in bits of a machine Int#.- ---#if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__)+#if !defined(__HADDOCK__) #include "MachDeps.h" #endif @@ -32,7 +32,7 @@ ) where -#if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__)+#if !defined(__HADDOCK__) import GHC.Base import GHC.Word (Word32(..),Word16(..),Word64(..)) @@ -70,19 +70,12 @@ shiftr_w w s = fromIntegral $ (`shiftr_w64` s) $ fromIntegral w #endif -#if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__)+#if !defined(__HADDOCK__) shiftr_w16 (W16# w) (I# i) = W16# (w `uncheckedShiftRL#` i) shiftr_w32 (W32# w) (I# i) = W32# (w `uncheckedShiftRL#` i) #if WORD_SIZE_IN_BITS < 64 shiftr_w64 (W64# w) (I# i) = W64# (w `uncheckedShiftRL64#` i)--#if __GLASGOW_HASKELL__ <= 606--- Exported by GHC.Word in GHC 6.8 and higher-foreign import ccall unsafe "stg_uncheckedShiftRL64"- uncheckedShiftRL64# :: Word64# -> Int# -> Word64#-#endif- #else shiftr_w64 (W64# w) (I# i) = W64# (w `uncheckedShiftRL#` i) #endif
src/Data/ByteString/Short/Internal.hs view
@@ -40,6 +40,9 @@ import Data.Typeable (Typeable) import Data.Data (Data(..), mkNoRepType)+#if MIN_VERSION_base(4,9,0)+import Data.Semigroup (Semigroup((<>)))+#endif import Data.Monoid (Monoid(..)) import Data.String (IsString(..)) import Control.DeepSeq (NFData(..))@@ -131,9 +134,18 @@ instance Ord ShortByteString where compare = compareBytes +#if MIN_VERSION_base(4,9,0)+instance Semigroup ShortByteString where+ (<>) = append+#endif+ instance Monoid ShortByteString where mempty = empty+#if MIN_VERSION_base(4,9,0)+ mappend = (<>)+#else mappend = append+#endif mconcat = concat instance NFData ShortByteString where@@ -152,11 +164,7 @@ gfoldl f z txt = z packBytes `f` (unpackBytes txt) toConstr _ = error "Data.ByteString.Short.ShortByteString.toConstr" gunfold _ _ = error "Data.ByteString.Short.ShortByteString.gunfold"-#if MIN_VERSION_base(4,2,0) dataTypeOf _ = mkNoRepType "Data.ByteString.Short.ShortByteString"-#else- dataTypeOf _ = mkNorepType "Data.ByteString.Short.ShortByteString"-#endif ------------------------------------------------------------------------ -- Simple operations