Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Make GHC 7.4.1 happier

  • Loading branch information...
commit d23abf68fd82f21dec7021c6c058e5e6446fd1e6 1 parent 7bc2f1c
@bos authored
Showing with 9 additions and 2 deletions.
  1. +5 −1 Data/BloomFilter/Array.hs
  2. +4 −1 tests/QCSupport.hs
View
6 Data/BloomFilter/Array.hs
@@ -1,11 +1,15 @@
-{-# LANGUAGE FlexibleContexts, ForeignFunctionInterface, MagicHash,
+{-# LANGUAGE CPP, FlexibleContexts, ForeignFunctionInterface, MagicHash,
Rank2Types, UnliftedFFITypes #-}
module Data.BloomFilter.Array (newArray) where
import Control.Monad.ST (ST, unsafeIOToST)
import Data.Array.Base (MArray, STUArray(..), unsafeNewArray_)
+#if __GLASGOW_HASKELL__ >= 704
+import Foreign.C.Types (CInt(..), CSize(..))
+#else
import Foreign.C.Types (CInt, CSize)
+#endif
import Foreign.Ptr (Ptr)
import GHC.Base (MutableByteArray#)
View
5 tests/QCSupport.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE GeneralizedNewtypeDeriving #-}
+{-# LANGUAGE CPP, GeneralizedNewtypeDeriving #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module QCSupport
@@ -23,6 +23,8 @@ instance Arbitrary P where
instance Arbitrary Ordering where
arbitrary = oneof [return LT, return GT, return EQ]
+-- For some reason, MIN_VERSION_random doesn't work here :-(
+#if __GLASGOW_HASKELL__ < 704
integralRandomR :: (Integral a, RandomGen g) => (a, a) -> g -> (a, g)
integralRandomR (a,b) g = case randomR (fromIntegral a :: Int,
fromIntegral b :: Int) g
@@ -31,6 +33,7 @@ integralRandomR (a,b) g = case randomR (fromIntegral a :: Int,
instance Random Int64 where
randomR = integralRandomR
random = randomR (minBound,maxBound)
+#endif
instance Arbitrary LB.ByteString where
arbitrary = sized $ \n -> resize (round (sqrt (toEnum n :: Double)))
Please sign in to comment.
Something went wrong with that request. Please try again.