From 523633a092b045b65f0d4722e72f118a09c991f2 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Sat, 9 Mar 2013 21:18:03 +0000 Subject: [PATCH] Setup.hs: switch to base-4 exceptions Fixes build failure on ghc-7.6: $ runhaskell Setup.hs configure Setup.hs:394:14: Not in scope: `E.try' base-4 is available/default since ghc-6.10. --- Setup.hs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Setup.hs b/Setup.hs index a0bc630b0..bb5ca2011 100644 --- a/Setup.hs +++ b/Setup.hs @@ -9,7 +9,7 @@ import Control.Monad import Data.List(isPrefixOf,intersect) import Data.Maybe(listToMaybe) import System.IO -import qualified System.IO.Error as E +import qualified Control.Exception as E import System.Cmd import System.FilePath import System.Directory @@ -18,6 +18,9 @@ import System.Exit import WebSetup +tryIOE :: IO a -> IO (Either E.IOException a) +tryIOE = E.try + main :: IO () main = defaultMainWithHooks simpleUserHooks{ preBuild =gfPreBuild , postBuild=buildRGL @@ -391,7 +394,7 @@ default_gf pkg lbi = buildDir lbi exeName' exeNameReal -- | Create autogen module with detailed version info by querying darcs extractDarcsVersion distFlag = - do info <- E.try askDarcs + do info <- tryIOE askDarcs createDirectoryIfMissing True autogenPath updateFile versionModulePath $ unlines $ ["module "++modname++" where", @@ -410,7 +413,7 @@ extractDarcsVersion distFlag = tag:_ -> ["--from-tag="++tag] changes <- lines `fmap` readProcess "darcs" ("changes":from) "" let dates = init' (filter ((`notElem` [""," "]).take 1) changes) - whatsnew<-E.try $ lines `fmap` readProcess "darcs" ["whatsnew","-s"] "" + whatsnew <- tryIOE $ lines `fmap` readProcess "darcs" ["whatsnew","-s"] "" return (listToMaybe tags,listToMaybe dates, length dates,either (const 0) length whatsnew) @@ -419,7 +422,7 @@ extractDarcsVersion distFlag = -- | Only update the file if contents has changed updateFile path new = - do old <- E.try $ readFile path + do old <- tryIOE $ readFile path when (Right new/=old) $ seq (either (const 0) length old) $ writeFile path new