mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
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.
This commit is contained in:
11
Setup.hs
11
Setup.hs
@@ -9,7 +9,7 @@ import Control.Monad
|
|||||||
import Data.List(isPrefixOf,intersect)
|
import Data.List(isPrefixOf,intersect)
|
||||||
import Data.Maybe(listToMaybe)
|
import Data.Maybe(listToMaybe)
|
||||||
import System.IO
|
import System.IO
|
||||||
import qualified System.IO.Error as E
|
import qualified Control.Exception as E
|
||||||
import System.Cmd
|
import System.Cmd
|
||||||
import System.FilePath
|
import System.FilePath
|
||||||
import System.Directory
|
import System.Directory
|
||||||
@@ -18,6 +18,9 @@ import System.Exit
|
|||||||
|
|
||||||
import WebSetup
|
import WebSetup
|
||||||
|
|
||||||
|
tryIOE :: IO a -> IO (Either E.IOException a)
|
||||||
|
tryIOE = E.try
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = defaultMainWithHooks simpleUserHooks{ preBuild =gfPreBuild
|
main = defaultMainWithHooks simpleUserHooks{ preBuild =gfPreBuild
|
||||||
, postBuild=buildRGL
|
, postBuild=buildRGL
|
||||||
@@ -391,7 +394,7 @@ default_gf pkg lbi = buildDir lbi </> exeName' </> exeNameReal
|
|||||||
|
|
||||||
-- | Create autogen module with detailed version info by querying darcs
|
-- | Create autogen module with detailed version info by querying darcs
|
||||||
extractDarcsVersion distFlag =
|
extractDarcsVersion distFlag =
|
||||||
do info <- E.try askDarcs
|
do info <- tryIOE askDarcs
|
||||||
createDirectoryIfMissing True autogenPath
|
createDirectoryIfMissing True autogenPath
|
||||||
updateFile versionModulePath $ unlines $
|
updateFile versionModulePath $ unlines $
|
||||||
["module "++modname++" where",
|
["module "++modname++" where",
|
||||||
@@ -410,7 +413,7 @@ extractDarcsVersion distFlag =
|
|||||||
tag:_ -> ["--from-tag="++tag]
|
tag:_ -> ["--from-tag="++tag]
|
||||||
changes <- lines `fmap` readProcess "darcs" ("changes":from) ""
|
changes <- lines `fmap` readProcess "darcs" ("changes":from) ""
|
||||||
let dates = init' (filter ((`notElem` [""," "]).take 1) changes)
|
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,
|
return (listToMaybe tags,listToMaybe dates,
|
||||||
length dates,either (const 0) length whatsnew)
|
length dates,either (const 0) length whatsnew)
|
||||||
|
|
||||||
@@ -419,7 +422,7 @@ extractDarcsVersion distFlag =
|
|||||||
|
|
||||||
-- | Only update the file if contents has changed
|
-- | Only update the file if contents has changed
|
||||||
updateFile path new =
|
updateFile path new =
|
||||||
do old <- E.try $ readFile path
|
do old <- tryIOE $ readFile path
|
||||||
when (Right new/=old) $ seq (either (const 0) length old) $
|
when (Right new/=old) $ seq (either (const 0) length old) $
|
||||||
writeFile path new
|
writeFile path new
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user