[commit: bytestring] ghc-7.6: Fixes for ghc-7.6+ (c890af7)
Paolo Capriotti
p.capriotti at gmail.com
Thu Sep 6 12:29:33 CEST 2012
Repository : ssh://darcs.haskell.org//srv/darcs/packages/bytestring
On branch : ghc-7.6
http://hackage.haskell.org/trac/ghc/changeset/c890af7a7520bd7015e2ea65f094e15ef7c06590
>---------------------------------------------------------------
commit c890af7a7520bd7015e2ea65f094e15ef7c06590
Author: Duncan Coutts <duncan at community.haskell.org>
Date: Thu Sep 6 00:48:05 2012 +0000
Fixes for ghc-7.6+
>---------------------------------------------------------------
bytestring.cabal | 2 +-
.../Data/ByteString/Builder/Prim/TestUtils.hs | 7 ++++++-
.../builder/Data/ByteString/Builder/Prim/Tests.hs | 4 ++--
3 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/bytestring.cabal b/bytestring.cabal
index 4a27c9e..e833c12 100644
--- a/bytestring.cabal
+++ b/bytestring.cabal
@@ -156,7 +156,7 @@ test-suite test-builder
byteorder == 1.0.*,
dlist == 0.5.*,
directory >= 1.0 && < 1.2,
- mtl == 2.0.*
+ mtl >= 2.0 && < 2.2
ghc-options: -Wall -fwarn-tabs
diff --git a/tests/builder/Data/ByteString/Builder/Prim/TestUtils.hs b/tests/builder/Data/ByteString/Builder/Prim/TestUtils.hs
index 194dcf4..861b6fb 100644
--- a/tests/builder/Data/ByteString/Builder/Prim/TestUtils.hs
+++ b/tests/builder/Data/ByteString/Builder/Prim/TestUtils.hs
@@ -74,7 +74,12 @@ import Data.Char (chr, ord)
import Numeric (showHex)
-import Foreign
+#if MIN_VERSION_base(4,4,0)
+import Foreign hiding (unsafePerformIO)
+import System.IO.Unsafe (unsafePerformIO)
+#else
+import Foreign
+#endif
import System.ByteOrder
import Unsafe.Coerce (unsafeCoerce)
diff --git a/tests/builder/Data/ByteString/Builder/Prim/Tests.hs b/tests/builder/Data/ByteString/Builder/Prim/Tests.hs
index a36f0b3..81870d1 100644
--- a/tests/builder/Data/ByteString/Builder/Prim/Tests.hs
+++ b/tests/builder/Data/ByteString/Builder/Prim/Tests.hs
@@ -159,7 +159,7 @@ zigZag x = (x `shiftL` 1) `xor` (x `shiftR` (8 * sizeOf x - 1))
-- forall x. fromIntegral x ==
-- unZigZag ((fromIntegral :: IntX -> WordX) (zigZag x))
--
-unZigZag :: (Storable a, Bits a) => a -> a
+unZigZag :: (Storable a, Num a, Bits a) => a -> a
unZigZag x = (x `shiftR` 1) `xor` negate (x .&. 1)
unZigZagInt8 :: Int8 -> Int8
@@ -178,7 +178,7 @@ unZigZagInt :: Int -> Int
unZigZagInt = (fromIntegral :: Word -> Int) . unZigZag . fromIntegral
-- | Check that the 'intVarSigned' encodings are parseable.
-prop_zigZag_parseable :: (Arbitrary t, Bits b, Show t, Eq t)
+prop_zigZag_parseable :: (Arbitrary t, Num b, Bits b, Show t, Eq t)
=> String -> (b -> t) -> BP.BoundedPrim t -> Test
prop_zigZag_parseable name unZig be =
compareImpls name (\x -> (x, [])) (first unZig . parseVar . evalB be)
More information about the Cvs-libraries
mailing list