Fix ignored-monadic-result warnings
[ghc-hetmet.git] / utils / ghc-pkg / Main.hs
index 3babd74..f79ebab 100644 (file)
@@ -61,7 +61,11 @@ import System.Posix hiding (fdToHandle)
 
 import IO ( isPermissionError )
 import System.Posix.Internals
+#if __GLASGOW_HASKELL__ >= 611
+import GHC.IO.Handle.FD (fdToHandle)
+#else
 import GHC.Handle (fdToHandle)
+#endif
 
 #if defined(GLOB)
 import System.Process(runInteractiveCommand)
@@ -356,7 +360,7 @@ parseGlobPackageId =
   parse
      +++
   (do n <- parse
-      string "-*"
+      _ <- string "-*"
       return (PackageIdentifier{ pkgName = n, pkgVersion = globVersion }))
 
 -- globVersion means "all versions"
@@ -502,7 +506,7 @@ readParseDatabase mb_user_conf filename
   | otherwise
   = do str <- readFile filename
        let packages = map convertPackageInfoIn $ read str
-       Exception.evaluate packages
+       _ <- Exception.evaluate packages
          `catchError` \e->
             die ("error while parsing " ++ filename ++ ": " ++ show e)
        return (filename,packages)
@@ -809,7 +813,7 @@ checkConsistency my_flags = do
             else do
               when (not simple_output) $ do
                   reportError ("There are problems in package " ++ display (package p) ++ ":")
-                  reportValidateErrors es "  " Nothing
+                  _ <- reportValidateErrors es "  " Nothing
                   return ()
               return [p]
 
@@ -1243,8 +1247,8 @@ installSignalHandlers = do
                                     (Exception.ErrorCall "interrupted")
   --
 #if !defined(mingw32_HOST_OS)
-  installHandler sigQUIT (Catch interrupt) Nothing
-  installHandler sigINT  (Catch interrupt) Nothing
+  _ <- installHandler sigQUIT (Catch interrupt) Nothing
+  _ <- installHandler sigINT  (Catch interrupt) Nothing
   return ()
 #elif __GLASGOW_HASKELL__ >= 603
   -- GHC 6.3+ has support for console events on Windows
@@ -1256,7 +1260,7 @@ installSignalHandlers = do
       sig_handler Break    = interrupt
       sig_handler _        = return ()
 
-  installHandler (Catch sig_handler)
+  _ <- installHandler (Catch sig_handler)
   return ()
 #else
   return () -- nothing
@@ -1338,8 +1342,12 @@ openNewFile dir template = do
 
     oflags = rw_flags .|. o_EXCL
 
+#if __GLASGOW_HASKELL__ < 611
+    withFilePath = withCString
+#endif
+
     findTempName x = do
-      fd <- withCString filepath $ \ f ->
+      fd <- withFilePath filepath $ \ f ->
               c_open f oflags 0o666
       if fd < 0
        then do