diff --git a/Network/BSD.hsc b/Network/BSD.hsc
--- a/Network/BSD.hsc
+++ b/Network/BSD.hsc
@@ -98,7 +98,12 @@
 import Control.Exception (catch)
 import Foreign.C.Error ( throwErrnoIfMinus1, throwErrnoIfMinus1_ )
 import Foreign.C.String ( CString, peekCString, peekCStringLen, withCString )
-import Foreign.C.Types ( CInt, CULong, CChar, CSize, CShort )
+import Foreign.C.Types ( CChar, CShort )
+#if __GLASGOW_HASKELL__ >= 703
+import Foreign.C.Types ( CInt(..), CULong(..), CSize(..) )
+#else
+import Foreign.C.Types ( CInt, CULong, CSize )
+#endif
 import Foreign.Ptr ( Ptr, nullPtr )
 import Foreign.Storable ( Storable(..) )
 import Foreign.Marshal.Array ( allocaArray0, peekArray0 )
diff --git a/Network/Socket.hsc b/Network/Socket.hsc
--- a/Network/Socket.hsc
+++ b/Network/Socket.hsc
@@ -184,7 +184,12 @@
 import Foreign.Storable ( Storable(..) )
 import Foreign.C.Error
 import Foreign.C.String ( CString, withCString, peekCString, peekCStringLen, castCharToCChar )
-import Foreign.C.Types ( CInt, CUInt, CChar, CSize )
+import Foreign.C.Types ( CUInt, CChar )
+#if __GLASGOW_HASKELL__ >= 703
+import Foreign.C.Types ( CInt(..), CSize(..) )
+#else
+import Foreign.C.Types ( CInt, CSize )
+#endif
 import Foreign.Marshal.Alloc ( alloca, allocaBytes )
 import Foreign.Marshal.Array ( peekArray, pokeArray, pokeArray0 )
 import Foreign.Marshal.Utils ( maybeWith, with )
diff --git a/Network/Socket/ByteString.hsc b/Network/Socket/ByteString.hsc
--- a/Network/Socket/ByteString.hsc
+++ b/Network/Socket/ByteString.hsc
@@ -47,7 +47,11 @@
 import Data.ByteString.Internal (createAndTrim)
 import Data.ByteString.Unsafe (unsafeUseAsCStringLen)
 import Data.Word (Word8)
+#if __GLASGOW_HASKELL__ >= 703
+import Foreign.C.Types (CInt(..))
+#else
 import Foreign.C.Types (CInt)
+#endif
 import Foreign.Marshal.Alloc (allocaBytes)
 import Foreign.Ptr (Ptr, castPtr)
 import Network.Socket (SockAddr, Socket(..), sendBufTo, recvBufFrom)
@@ -58,7 +62,12 @@
 
 #if !defined(mingw32_HOST_OS)
 import Control.Monad (zipWithM_)
-import Foreign.C.Types (CChar, CSize)
+import Foreign.C.Types (CChar)
+# if __GLASGOW_HASKELL__ >= 703
+import Foreign.C.Types (CSize(..))
+# else
+import Foreign.C.Types (CSize)
+# endif
 import Foreign.Marshal.Array (allocaArray)
 import Foreign.Marshal.Utils (with)
 import Foreign.Ptr (plusPtr)
diff --git a/Network/Socket/ByteString/Internal.hs b/Network/Socket/ByteString/Internal.hs
--- a/Network/Socket/ByteString/Internal.hs
+++ b/Network/Socket/ByteString/Internal.hs
@@ -20,9 +20,14 @@
 import System.IO.Error (ioeSetErrorString, mkIOError)
 
 #if !defined(mingw32_HOST_OS)
+# if __GLASGOW_HASKELL__ >= 703
+import Foreign.C.Types (CInt(..))
+import System.Posix.Types (CSsize(..))
+# else
 import Foreign.C.Types (CInt)
-import Foreign.Ptr (Ptr)
 import System.Posix.Types (CSsize)
+# endif
+import Foreign.Ptr (Ptr)
 
 import Network.Socket.ByteString.IOVec (IOVec)
 import Network.Socket.ByteString.MsgHdr (MsgHdr)
diff --git a/Network/Socket/Internal.hsc b/Network/Socket/Internal.hsc
--- a/Network/Socket/Internal.hsc
+++ b/Network/Socket/Internal.hsc
@@ -64,7 +64,11 @@
 import Foreign.C.Error (throwErrno, throwErrnoIfMinus1Retry,
                         throwErrnoIfMinus1RetryMayBlock, throwErrnoIfMinus1_)
 import Foreign.C.String ( castCharToCChar, peekCString )
+#if __GLASGOW_HASKELL__ >= 703
+import Foreign.C.Types ( CInt(..), CSize(..) )
+#else
 import Foreign.C.Types ( CInt, CSize )
+#endif
 import Foreign.Marshal.Alloc ( allocaBytes )
 import Foreign.Marshal.Array ( pokeArray, pokeArray0 )
 import Foreign.Ptr ( Ptr, castPtr, plusPtr )
@@ -514,8 +518,9 @@
 -- the IO action returns a result of @-1@.  Discards the result of the
 -- IO action after error handling.
 throwSocketErrorIfMinus1_
-    :: Num a => String  -- ^ textual description of the location
-    -> IO a             -- ^ the 'IO' operation to be executed
+    :: (Eq a, Num a)
+    => String  -- ^ textual description of the location
+    -> IO a    -- ^ the 'IO' operation to be executed
     -> IO ()
 
 {-# SPECIALIZE throwSocketErrorIfMinus1_ :: String -> IO CInt -> IO () #-}
@@ -524,8 +529,9 @@
 -- the IO action returns a result of @-1@, but retries in case of an
 -- interrupted operation.
 throwSocketErrorIfMinus1Retry
-    :: Num a => String  -- ^ textual description of the location
-    -> IO a             -- ^ the 'IO' operation to be executed
+    :: (Eq a, Num a)
+    => String  -- ^ textual description of the location
+    -> IO a    -- ^ the 'IO' operation to be executed
     -> IO a
 
 {-# SPECIALIZE throwSocketErrorIfMinus1Retry :: String -> IO CInt -> IO CInt #-}
@@ -535,10 +541,11 @@
 -- interrupted operation.  Checks for operations that would block and
 -- executes an alternative action before retrying in that case.
 throwSocketErrorIfMinus1RetryMayBlock
-    :: Num a => String  -- ^ textual description of the location
-    -> IO b             -- ^ action to execute before retrying if an
-                        --   immediate retry would block
-    -> IO a             -- ^ the 'IO' operation to be executed
+    :: (Eq a, Num a)
+    => String  -- ^ textual description of the location
+    -> IO b    -- ^ action to execute before retrying if an
+               --   immediate retry would block
+    -> IO a    -- ^ the 'IO' operation to be executed
     -> IO a
 
 {-# SPECIALIZE throwSocketErrorIfMinus1RetryMayBlock
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -6156,7 +6156,7 @@
     cat >>$CONFIG_STATUS <<_ACEOF
     # First, check the format of the line:
     cat >"\$tmp/defines.sed" <<\\CEOF
-/^[	 ]*#[	 ]*undef[	 ][	 ]*$ac_word_re[	 ]*\$/b def
+/^[	 ]*#[	 ]*undef[	 ][	 ]*$ac_word_re[	 ]*/b def
 /^[	 ]*#[	 ]*define[	 ][	 ]*$ac_word_re[(	 ]/b def
 b
 :def
diff --git a/network.cabal b/network.cabal
--- a/network.cabal
+++ b/network.cabal
@@ -1,5 +1,5 @@
 name:           network
-version:        2.3.0.6
+version:        2.3.0.7
 license:        BSD3
 license-file:   LICENSE
 maintainer:     Johan Tibell <johan.tibell@gmail.com>
