[commit: packages/Cabal] ghc-head: Slim down exception compatibility modules (80a2226)

git at git.haskell.org git at git.haskell.org
Mon Aug 26 23:27:39 CEST 2013


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/?p=packages/Cabal.git;a=commit;h=80a2226a5ce3172ff825156fef832ef0abf3b9d7

>---------------------------------------------------------------

commit 80a2226a5ce3172ff825156fef832ef0abf3b9d7
Author: Ben Millwood <thebenmachine+git at gmail.com>
Date:   Wed Jun 26 10:54:00 2013 +0100

    Slim down exception compatibility modules
    
    handleIO and throwIOIO in the cabal-install compat module were
    completely unused, so they're just binned.
    
    IOException, SomeException and onException are now just used from
    Control.Exception, since these days it's available on all supported
    build configurations.
    
    There are some more functions which can be removed, but these are the
    easiest and least invasive.


>---------------------------------------------------------------

80a2226a5ce3172ff825156fef832ef0abf3b9d7
 Cabal/Distribution/Compat/Exception.hs         |    5 -----
 Cabal/Distribution/Compat/TempFile.hs          |    3 ++-
 Cabal/Distribution/Simple/Utils.hs             |    4 ++--
 cabal-install/Distribution/Client/Install.hs   |    7 +++----
 cabal-install/Distribution/Client/Types.hs     |    2 +-
 cabal-install/Distribution/Compat/Exception.hs |   14 --------------
 6 files changed, 8 insertions(+), 27 deletions(-)

diff --git a/Cabal/Distribution/Compat/Exception.hs b/Cabal/Distribution/Compat/Exception.hs
index ff85613..2662b20 100644
--- a/Cabal/Distribution/Compat/Exception.hs
+++ b/Cabal/Distribution/Compat/Exception.hs
@@ -1,6 +1,4 @@
 module Distribution.Compat.Exception (
-     Exception.IOException,
-     onException,
      catchIO,
      catchExit,
      throwIOIO,
@@ -10,9 +8,6 @@ module Distribution.Compat.Exception (
 import System.Exit
 import qualified Control.Exception as Exception
 
-onException :: IO a -> IO b -> IO a
-onException = Exception.onException
-
 throwIOIO :: Exception.IOException -> IO a
 throwIOIO = Exception.throwIO
 
diff --git a/Cabal/Distribution/Compat/TempFile.hs b/Cabal/Distribution/Compat/TempFile.hs
index a8476cc..fe01c29 100644
--- a/Cabal/Distribution/Compat/TempFile.hs
+++ b/Cabal/Distribution/Compat/TempFile.hs
@@ -19,7 +19,8 @@ import System.IO.Error        (isAlreadyExistsError)
 import System.Posix.Internals (withFilePath)
 import Foreign.C              (CInt)
 import GHC.IO.Handle.FD       (fdToHandle)
-import Distribution.Compat.Exception (onException, tryIO)
+import Distribution.Compat.Exception (tryIO)
+import Control.Exception      (onException)
 import Foreign.C              (getErrno, errnoToIOError)
 
 import System.Posix.Internals (c_getpid)
diff --git a/Cabal/Distribution/Simple/Utils.hs b/Cabal/Distribution/Simple/Utils.hs
index c5385cc..c4970d5 100644
--- a/Cabal/Distribution/Simple/Utils.hs
+++ b/Cabal/Distribution/Simple/Utils.hs
@@ -187,7 +187,7 @@ import qualified Distribution.ModuleName as ModuleName
 import Distribution.Version
     (Version(..))
 
-import Control.Exception (evaluate)
+import Control.Exception (IOException, evaluate)
 import System.Process (runProcess)
 
 import Control.Concurrent (forkIO)
@@ -202,7 +202,7 @@ import Distribution.Compat.CopyFile
 import Distribution.Compat.TempFile
          ( openTempFile, createTempDirectory )
 import Distribution.Compat.Exception
-         ( IOException, throwIOIO, tryIO, catchIO, catchExit )
+         ( throwIOIO, tryIO, catchIO, catchExit )
 import Distribution.Verbosity
 
 #ifdef VERSION_base
diff --git a/cabal-install/Distribution/Client/Install.hs b/cabal-install/Distribution/Client/Install.hs
index 2e94621..ff16181 100644
--- a/cabal-install/Distribution/Client/Install.hs
+++ b/cabal-install/Distribution/Client/Install.hs
@@ -32,13 +32,12 @@ import Data.List
 import Data.Maybe
          ( isJust, fromMaybe, maybeToList )
 import Control.Exception as Exception
-         ( bracket, handleJust )
-import Control.Exception as Exception
-         ( Exception(toException), catches, Handler(Handler), IOException )
+         ( Exception(toException), bracket, catches, Handler(Handler), handleJust
+         , IOException, SomeException )
 import System.Exit
          ( ExitCode )
 import Distribution.Compat.Exception
-         ( SomeException, catchIO, catchExit )
+         ( catchIO, catchExit )
 import Control.Monad
          ( when, unless )
 import System.Directory
diff --git a/cabal-install/Distribution/Client/Types.hs b/cabal-install/Distribution/Client/Types.hs
index 3ae2387..a27e9b8 100644
--- a/cabal-install/Distribution/Client/Types.hs
+++ b/cabal-install/Distribution/Client/Types.hs
@@ -30,7 +30,7 @@ import Distribution.Version
 import Data.Map (Map)
 import Network.URI (URI)
 import Data.ByteString.Lazy (ByteString)
-import Distribution.Compat.Exception
+import Control.Exception
          ( SomeException )
 
 newtype Username = Username { unUsername :: String }
diff --git a/cabal-install/Distribution/Compat/Exception.hs b/cabal-install/Distribution/Compat/Exception.hs
index 56b9a18..72c715b 100644
--- a/cabal-install/Distribution/Compat/Exception.hs
+++ b/cabal-install/Distribution/Compat/Exception.hs
@@ -1,19 +1,14 @@
 {-# LANGUAGE CPP #-}
 {-# OPTIONS_HADDOCK hide #-}
 module Distribution.Compat.Exception (
-  SomeException,
   mask,
   mask_,
-  onException,
   catchIO,
-  handleIO,
   catchExit,
-  throwIOIO
   ) where
 
 import System.Exit
 import qualified Control.Exception as Exception
-import Control.Exception (SomeException)
 
 #if MIN_VERSION_base(4,3,0)
 -- it's much less of a headache if we re-export the "real" mask and mask_
@@ -33,17 +28,8 @@ mask_ :: IO a -> IO a
 mask_ = block
 #endif
 
-onException :: IO a -> IO b -> IO a
-onException = Exception.onException
-
-throwIOIO :: Exception.IOException -> IO a
-throwIOIO = Exception.throwIO
-
 catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a
 catchIO = Exception.catch
 
-handleIO :: (Exception.IOException -> IO a) -> IO a -> IO a
-handleIO = flip catchIO
-
 catchExit :: IO a -> (ExitCode -> IO a) -> IO a
 catchExit = Exception.catch





More information about the ghc-commits mailing list