summaryrefslogtreecommitdiff
path: root/Setup.hs
diff options
context:
space:
mode:
authorSergei Trofimovich <slyfox@community.haskell.org>2013-03-09 21:18:03 +0000
committerSergei Trofimovich <slyfox@community.haskell.org>2013-03-09 21:18:03 +0000
commit523633a092b045b65f0d4722e72f118a09c991f2 (patch)
tree105b07324f02d7991f224ffa65ce33a3c398904c /Setup.hs
parent921951a5e2f634b04d514bbbf067e2a39461d5af (diff)
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.
Diffstat (limited to 'Setup.hs')
-rw-r--r--Setup.hs11
1 files 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