libraries/binary does not compile with ghc-7.7

Gabor Greif ggreif at gmail.com
Wed Feb 20 16:57:25 CET 2013


Hi all,

when bootstrapping with GHC-7.7 I get

  HC [stage 0] libraries/binary/dist-boot/build/Data/Binary/Get.o

libraries/binary/src/Data/Binary/Get.hs:101:1: Warning:
    The import of `GHC.Int' is redundant
      except perhaps to import instances from `GHC.Int'
    To import instances alone, use: import GHC.Int()

libraries/binary/src/Data/Binary/Get.hs:371:15: Warning:
    In the use of `unsafeInterleaveST'
    (imported from Control.Monad.ST):
    Deprecated: "Please import from Control.Monad.ST.Unsafe instead;
This will be removed in the next release"

libraries/binary/src/Data/Binary/Get.hs:383:44: Warning:
    In the use of `unsafeInterleaveST'
    (imported from Control.Monad.ST):
    Deprecated: "Please import from Control.Monad.ST.Unsafe instead;
This will be removed in the next release"
  HC [stage 0] libraries/binary/dist-boot/build/Data/Binary/Builder/Base.o

libraries/binary/src/Data/Binary/Builder/Base.hs:180:22:
    Ambiguous occurrence `unsafePerformIO'
    It could refer to either `Foreign.unsafePerformIO',
                             imported from `Foreign' at
libraries/binary/src/Data/Binary/Builder/Base.hs:69:1-14
                          or `System.IO.Unsafe.unsafePerformIO',
                             imported from `System.IO.Unsafe' at
libraries/binary/src/Data/Binary/Builder/Base.hs:71:1-23
                             (and originally defined in `GHC.IO')
make[1]: *** [libraries/binary/dist-boot/build/Data/Binary/Builder/Base.o]
Error 1


I have two commits to fix this:

$ git show ded894cd6abb209406e2ce16361acbb7111774d0
commit ded894cd6abb209406e2ce16361acbb7111774d0
Author: Gabor Greif <ggreif at gmail.com>
Date:   Thu Oct 25 12:59:53 2012 +0200

    fix import warnings

diff --git a/src/Data/Binary/Get.hs b/src/Data/Binary/Get.hs
index 7134217..eaba669 100644
--- a/src/Data/Binary/Get.hs
+++ b/src/Data/Binary/Get.hs
@@ -92,13 +92,13 @@ import Control.Applicative (Applicative(..))
 import Foreign

 -- used by splitAtST
-import Control.Monad.ST
+import Control.Monad.ST (ST, runST)
+import Control.Monad.ST.Unsafe (unsafeInterleaveST)
 import Data.STRef

 #if defined(__GLASGOW_HASKELL__) && !defined(__HADDOCK__)
 import GHC.Base
 import GHC.Word
-import GHC.Int
 #endif

 -- | The parse state


$ git show 9c8b00ab88b6b8b996e0725d242df9a225d4236e
commit 9c8b00ab88b6b8b996e0725d242df9a225d4236e
Author: Gabor Greif <ggreif at gmail.com>
Date:   Thu Oct 25 13:39:28 2012 +0200

    do not import unsafePerformIO from Foreign (eliminating warning)

diff --git a/src/Data/Binary/Builder/Base.hs b/src/Data/Binary/Builder/Base.hs
index 8124f65..31b5115 100644
--- a/src/Data/Binary/Builder/Base.hs
+++ b/src/Data/Binary/Builder/Base.hs
@@ -67,6 +67,7 @@ import qualified Data.ByteString.Lazy as L
 import Data.Monoid
 import Data.Word
 import Foreign
+import System.IO.Unsafe (unsafePerformIO)

 #ifdef BYTESTRING_IN_BASE
 import Data.ByteString.Base (inlinePerformIO)
@@ -174,7 +175,7 @@ data Buffer = Buffer {-# UNPACK #-} !(ForeignPtr Word8)
 -- the lazy 'L.ByteString' is demanded.
 --
 toLazyByteString :: Builder -> L.ByteString
-toLazyByteString m = unsafePerformIO $ do
+toLazyByteString m = System.IO.Unsafe.unsafePerformIO $ do
     buf <- newBuffer defaultSize
     runBuilder (m `append` flush) (const (return L.Empty)) buf
 {-# INLINE toLazyByteString #-}


Okay to push to master?

Cheers,

    Gabor



More information about the ghc-devs mailing list