bytestring-show 0.3.5.5 → 0.3.5.6
raw patch · 6 files changed
+44/−73 lines, 6 filesdep ~arraydep ~binary
Dependency ranges changed: array, binary
Files
- Tests/Properties.hs +0/−46
- Text/Show/ByteString.hs +1/−1
- Text/Show/ByteString/Float.hs +2/−2
- Text/Show/ByteString/Int.hs +36/−11
- Text/Show/ByteString/Integer.hs +3/−3
- bytestring-show.cabal +2/−10
− Tests/Properties.hs
@@ -1,46 +0,0 @@--module Main where--import Test.QuickCheck--import Data.Complex-import Data.Int-import Data.Word-import Data.Ratio--import qualified Text.Show.ByteString as S--import qualified Data.ByteString.Lazy.Char8 as L--test_matchesShow :: (Show a, S.Show a, Arbitrary a) => a -> Bool-test_matchesShow a = show a == L.unpack (S.show a)--instance Arbitrary Int64 where- arbitrary = fmap fromInteger arbitrary- coarbitrary _ = id--instance Arbitrary Word64 where- arbitrary = fmap (fromInteger . abs) arbitrary- coarbitrary _ = id--test_all :: IO ()-test_all = do quickCheck (test_matchesShow :: Int -> Bool)--- quickCheck (test_matchesShow :: Int8 -> Bool)--- quickCheck (test_matchesShow :: Int16 -> Bool)--- quickCheck (test_matchesShow :: Int32 -> Bool)- quickCheck (test_matchesShow :: Int64 -> Bool)--- quickCheck (test_matchesShow :: Word -> Bool)--- quickCheck (test_matchesShow :: Word8 -> Bool)--- quickCheck (test_matchesShow :: Word16 -> Bool)--- quickCheck (test_matchesShow :: Word32 -> Bool)- quickCheck (test_matchesShow :: Word64 -> Bool)- quickCheck (test_matchesShow :: () -> Bool)- quickCheck (test_matchesShow :: Integer -> Bool)- quickCheck (test_matchesShow :: Float -> Bool)- quickCheck (test_matchesShow :: Double -> Bool)--- quickCheck (test_matchesShow :: Rational -> Bool)- quickCheck (test_matchesShow :: (Int,Int,Int) -> Bool)- quickCheck (test_matchesShow :: (Int,Int,Int,Int) -> Bool)- quickCheck (test_matchesShow :: [Int] -> Bool)--main = test_all
Text/Show/ByteString.hs view
@@ -44,7 +44,7 @@ import qualified Prelude import Data.Binary.Put-import Data.ByteString.Lazy+import Data.ByteString.Lazy.Char8 import Data.Int import Data.Word
Text/Show/ByteString/Float.hs view
@@ -46,7 +46,7 @@ | otherwise = go fmt (floatToDigits (toInteger base) f) where base = 10- + go FFGeneric p@(_,e) | e < 0 || e > 7 = go FFExponent p | otherwise = go FFFixed p@@ -86,6 +86,6 @@ let (ei, is') = roundTo base dec' (replicate (-e) 0 ++ is) d:ds = if ei > 0 then is' else 0:is' in unsafePutDigit d >> when (not $ null ds) (putAscii '.' >> mapM_ unsafePutDigit ds)- + mk0 [] = putAscii '0' mk0 rs = mapM_ unsafePutDigit rs
Text/Show/ByteString/Int.hs view
@@ -1,5 +1,6 @@-{-# OPTIONS_GHC -funbox-strict-fields -cpp #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE MagicHash #-}+{-# LANGUAGE BangPatterns #-} -- --------------------------------------------------------------------------- -- |@@ -27,22 +28,46 @@ putI :: Int# -> Put putI i#-#if __GLASGOW_HASKELL__ && __GLASGOW_HASKELL__ >= 611+#if __GLASGOW_HASKELL__ && __GLASGOW_HASKELL__ >= 708+ = case i# <# 0# of+ 1# -> let !(I# minInt#) = minInt+#elif __GLASGOW_HASKELL__ && __GLASGOW_HASKELL__ >= 611 | i# <# 0# = let !(I# minInt#) = minInt #else | i# <# 0# = let I# minInt# = minInt #endif- in if i# ==# minInt#- then putWord8 45 >> putW (int2Word# (negateInt# (i# `quotInt#` 10#)))+ in case i# ==# minInt# of+#if __GLASGOW_HASKELL__ && __GLASGOW_HASKELL__ >= 708+ 1# ->+#else+ True ->+#endif+ putWord8 45 >> putW (int2Word# (negateInt# (i# `quotInt#` 10#))) >> putW (int2Word# (negateInt# (i# `remInt#` 10#)))- else putWord8 45 >> putW (int2Word# (negateInt# i#))+ _ ->+ putWord8 45 >> putW (int2Word# (negateInt# i#))+#if __GLASGOW_HASKELL__ && __GLASGOW_HASKELL__ >= 708+ _ -> putW (int2Word# i#)+#else | otherwise = putW (int2Word# i#)+#endif putW :: Word# -> Put putW w#- | w# `ltWord#` int2Word# 10# = unsafePutDigit# w#- | otherwise = putW (w# `quotWord#` int2Word# 10#)- >> unsafePutDigit# (w# `remWord#` int2Word# 10#)+#if __GLASGOW_HASKELL__ && __GLASGOW_HASKELL__ >= 708+ = case w# `ltWord#` int2Word# 10# of+ 1# ->+#else+ | w# `ltWord#` int2Word# 10# =+#endif+ unsafePutDigit# w#+#if __GLASGOW_HASKELL__ && __GLASGOW_HASKELL__ >= 708+ _ ->+#else+ | otherwise =+#endif+ putW (w# `quotWord#` int2Word# 10#)+ >> unsafePutDigit# (w# `remWord#` int2Word# 10#) showpInt :: Int -> Put showpInt (I# i#) = putI i#@@ -65,8 +90,8 @@ -- Unboxed 64-bit-specific operations aren't exported putI64 :: Int64 -> Put-putI64 i | i == minBound = putWord8 45 - >> putW64 (fromIntegral $ negate (i `quot` 10)) +putI64 i | i == minBound = putWord8 45+ >> putW64 (fromIntegral $ negate (i `quot` 10)) >> putW64 (fromIntegral $ negate (i `rem` 10)) | i < 0 = putWord8 45 >> putW64 (fromIntegral $ negate i) | otherwise = putW64 (fromIntegral i)@@ -92,7 +117,7 @@ putW64 :: Word64 -> Put putW64 w | w < 10 = unsafePutDigit64 w- | otherwise = putW64 (w `quot` 10) + | otherwise = putW64 (w `quot` 10) >> unsafePutDigit64 (w `rem` 10) where unsafePutDigit64 w = unsafePutDigit# (case fromIntegral w of (W# w#) -> w#)
Text/Show/ByteString/Integer.hs view
@@ -65,7 +65,7 @@ #if defined(INTEGER_GMP) || defined(INTEGER_SIMPLE) (# q, r #) -> #else- (q, r) -> + (q, r) -> #endif if q > 0 then q : r : splitb p ns@@ -124,8 +124,8 @@ showpIntAtBase b f n | n < 0 = putAscii '-' >> showpIntAtBase b f (-n) | n == 0 = putAscii (f 0) | otherwise = let- go n | n == 0 = return ()+ go k | k == 0 = return () | otherwise = go d >> putAscii (f $ fromIntegral m) where- (d, m) = n `divMod` b+ (d, m) = k `divMod` b in go n
bytestring-show.cabal view
@@ -1,5 +1,5 @@ name: bytestring-show-version: 0.3.5.5+version: 0.3.5.6 license: BSD3 license-file: LICENSE author: Dan Doel@@ -16,7 +16,7 @@ description: use with integer-simple build of GHC library- build-depends: base < 5, binary < 0.8, bytestring >= 0.9 && <= 1, array < 0.5, containers < 0.6+ build-depends: base < 5, binary < 0.8, bytestring >= 0.9 && <= 1, array < 0.6, containers < 0.6 exposed-modules: Text.Show.ByteString@@ -27,14 +27,6 @@ Text.Show.ByteString.Int Text.Show.ByteString.Float Text.Show.ByteString.Integer-- extensions:- UnboxedTuples,- MagicHash,- BangPatterns,- TypeSynonymInstances,- CPP,- FlexibleInstances ghc-options: -O2 -Wall