Skip to content

Commit b6d54b2

Browse files
committed
Fix building with GHC 7.0 and 7.2
1 parent 8c71422 commit b6d54b2

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

Codec/Compression/Zlib/Stream.hsc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,15 @@ module Codec.Compression.Zlib.Stream (
9494

9595
) where
9696

97+
-- Note we don't use the MIN_VERSION_* macros here for compatability with
98+
-- old Cabal versions that come with old GHC, that didn't provide these
99+
-- macros for .hsc files. So we use __GLASGOW_HASKELL__ as a proxy.
100+
97101
import Foreign
98102
( Word8, Ptr, nullPtr, plusPtr, peekByteOff, pokeByteOff
99103
, ForeignPtr, FinalizerPtr, mallocForeignPtrBytes, addForeignPtrFinalizer
100104
, withForeignPtr, touchForeignPtr, minusPtr )
101-
#if MIN_VERSION_base(4,4,0)
105+
#if __GLASGOW_HASKELL__ >= 702
102106
import Foreign.ForeignPtr.Unsafe ( unsafeForeignPtrToPtr )
103107
import System.IO.Unsafe ( unsafePerformIO )
104108
#else
@@ -112,12 +116,12 @@ import Foreign.C
112116
import Data.ByteString.Internal (nullForeignPtr)
113117
import qualified Data.ByteString.Unsafe as B
114118
import Data.ByteString (ByteString)
115-
#if !(MIN_VERSION_base(4,8,0))
119+
#if !(__GLASGOW_HASKELL__ >= 710)
116120
import Control.Applicative (Applicative(..))
117121
#endif
118122
import Control.Monad (ap,liftM)
119-
#if MIN_VERSION_base(4,4,0)
120-
#if MIN_VERSION_base(4,7,0)
123+
#if __GLASGOW_HASKELL__ >= 702
124+
#if __GLASGOW_HASKELL__ >= 708
121125
import Control.Monad.ST.Strict
122126
#else
123127
import Control.Monad.ST.Strict hiding (unsafeIOToST)

0 commit comments

Comments
 (0)