[commit: Cabal] master: Fix the GHC HEAD build: Don't use deprecated catch function (7eb960f)

Ian Lynagh igloo at earth.li
Wed Apr 27 03:23:22 CEST 2011


Repository : ssh://darcs.haskell.org//srv/darcs/packages/Cabal

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/7eb960f998d2caaa90d2d39e9950d339a6b0563f

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

commit 7eb960f998d2caaa90d2d39e9950d339a6b0563f
Author: Ian Lynagh <igloo at earth.li>
Date:   Tue Apr 26 23:20:15 2011 +0000

    Fix the GHC HEAD build: Don't use deprecated catch function
    We could make this conditional, to support old GHC versions, but I
    don't think it is worth the cost to support 6.8. By the time this Cabal
    is released, you will need at least 6.12 (if not higher) to build the
    GHC it comes with.

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

 Distribution/Simple/Build/PathsModule.hs |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/Distribution/Simple/Build/PathsModule.hs b/Distribution/Simple/Build/PathsModule.hs
index 0d266bf..b4d69a0 100644
--- a/Distribution/Simple/Build/PathsModule.hs
+++ b/Distribution/Simple/Build/PathsModule.hs
@@ -72,10 +72,13 @@ generate pkg_descr lbi =
         "  ) where\n"++
         "\n"++
         foreign_imports++
-        "import Prelude (catch, IO, FilePath, return, (++))\n"++
+        "import qualified Control.Exception as Exception\n"++
         "import Data.Version (Version(..))\n"++
         "import System.Environment (getEnv)"++
         "\n"++
+        "catchIO :: IO a -> (Exception.IOException -> IO a) -> IO a\n"++
+        "catchIO = Exception.catch\n" ++
+        "\n"++
         "\nversion :: Version"++
         "\nversion = " ++ show (packageVersion pkg_descr)
 
@@ -140,7 +143,7 @@ generate pkg_descr lbi =
         mkGetDir _   (Just dirrel) = "getPrefixDirRel " ++ show dirrel
         mkGetDir dir Nothing       = "return " ++ show dir
 
-        mkGetEnvOr var expr = "catch (getEnv \""++var'++"\")"++
+        mkGetEnvOr var expr = "catchIO (getEnv \""++var'++"\")"++
                               " (\\_ -> "++expr++")"
           where var' = pkgPathEnvVar pkg_descr var
 





More information about the Cvs-libraries mailing list