diff --git a/Database/PostgreSQL/Typed/Protocol.hs b/Database/PostgreSQL/Typed/Protocol.hs
--- a/Database/PostgreSQL/Typed/Protocol.hs
+++ b/Database/PostgreSQL/Typed/Protocol.hs
@@ -127,6 +127,7 @@
 import           System.IO.Error (IOError, mkIOError, eofErrorType, ioError, ioeSetErrorString)
 import           System.IO.Unsafe (unsafeInterleaveIO)
 import           Text.Read (readMaybe)
+import           Text.Show.Functions ()
 
 import Database.PostgreSQL.Typed.Types
 import Database.PostgreSQL.Typed.Dynamic
@@ -186,7 +187,7 @@
 #ifdef VERSION_tls
   , pgDBTLS :: PGTlsMode -- ^ TLS mode
 #endif
-  }
+  } deriving (Show)
 
 instance Eq PGDatabase where
 #ifdef VERSION_tls
@@ -1139,7 +1140,15 @@
 recvBufNonBlock s ptr nbytes
  | nbytes <= 0 = ioError (mkInvalidRecvArgError "Database.PostgreSQL.Typed.recvBufNonBlock")
  | otherwise   = do
-    len <- c_recv (Net.fdSocket s) (castPtr ptr) (fromIntegral nbytes) 0
+    len <-
+#if MIN_VERSION_network(3,1,0)
+      Net.withFdSocket s $ \fd ->
+#elif MIN_VERSION_network(3,0,0)
+      Net.fdSocket s >>= \fd ->
+#else
+      let fd = Net.fdSocket s in
+#endif
+        c_recv fd (castPtr ptr) (fromIntegral nbytes) 0
     if len == -1
       then do
         errno <- getErrno
diff --git a/Database/PostgreSQL/Typed/TemplatePG.hs b/Database/PostgreSQL/Typed/TemplatePG.hs
--- a/Database/PostgreSQL/Typed/TemplatePG.hs
+++ b/Database/PostgreSQL/Typed/TemplatePG.hs
@@ -1,3 +1,4 @@
+{-# LANGUAGE CPP #-}
 {-# LANGUAGE TemplateHaskell #-}
 {-# OPTIONS_GHC -Wno-deprecations #-}
 -- Copyright 2010, 2011, 2012, 2013 Chris Forno
@@ -20,6 +21,9 @@
   , rollback
   , PGException
   , pgConnect
+#if !MIN_VERSION_network(3,0,0)
+  , PortID(..)
+#endif
   , PG.pgDisconnect
   ) where
 
@@ -30,7 +34,11 @@
 import qualified Data.ByteString.Lazy.Char8 as BSLC
 import           Data.Maybe (listToMaybe, isJust)
 import qualified Language.Haskell.TH as TH
-import           Network (HostName, PortID(..))
+#if MIN_VERSION_network(3,0,0)
+import           Data.Word (Word16)
+#else
+import           Network (PortID(..))
+#endif
 import qualified Network.Socket as Net
 import           System.Environment (lookupEnv)
 
@@ -91,7 +99,12 @@
 
 type PGException = PG.PGError
 
-pgConnect :: HostName   -- ^ the host to connect to
+#if MIN_VERSION_network(3,0,0)
+-- |For backwards compatibility with old network package.
+data PortID = Service String | PortNumber Word16 | UnixSocket String
+#endif
+
+pgConnect :: String     -- ^ the host to connect to
           -> PortID     -- ^ the port to connect on
           -> ByteString -- ^ the database to connect to
           -> ByteString -- ^ the username to connect as
diff --git a/postgresql-typed.cabal b/postgresql-typed.cabal
--- a/postgresql-typed.cabal
+++ b/postgresql-typed.cabal
@@ -1,5 +1,5 @@
 Name:          postgresql-typed
-Version:       0.6
+Version:       0.6.0.1
 Cabal-Version: >= 1.8
 License:       BSD3
 License-File:  COPYING
