summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorhallgren <hallgren@chalmers.se>2012-11-08 15:53:46 +0000
committerhallgren <hallgren@chalmers.se>2012-11-08 15:53:46 +0000
commit63093c32f33ad1fcfef10d2ef6ef010c2b5471e9 (patch)
treed41a1ea8c6c5e58353f3a81440291be6d57d6e3b /src/compiler
parent1c0429c322d71c5488604785cf7278fe4ac67bf7 (diff)
Eliminate warnings about deprecated use of catch and try
This is also needed for compatibility with GHC 7.6.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/GF/Compile/GetGrammar.hs3
-rw-r--r--src/compiler/GF/Compile/ReadFiles.hs2
-rw-r--r--src/compiler/GF/Infra/SIO.hs2
-rw-r--r--src/compiler/GF/Infra/UseIO.hs5
-rw-r--r--src/compiler/GF/System/Catch.hs14
-rw-r--r--src/compiler/GFServer.hs3
6 files changed, 26 insertions, 3 deletions
diff --git a/src/compiler/GF/Compile/GetGrammar.hs b/src/compiler/GF/Compile/GetGrammar.hs
index cc4ca841c..b8832ba64 100644
--- a/src/compiler/GF/Compile/GetGrammar.hs
+++ b/src/compiler/GF/Compile/GetGrammar.hs
@@ -14,8 +14,11 @@
module GF.Compile.GetGrammar (getSourceModule) where
+import Prelude hiding (catch)
+
import GF.Data.Operations
+import GF.System.Catch
import GF.Infra.UseIO
import GF.Infra.Option(Options,optPreprocessors,addOptions,flag)
import GF.Grammar.Lexer
diff --git a/src/compiler/GF/Compile/ReadFiles.hs b/src/compiler/GF/Compile/ReadFiles.hs
index 276aa2975..9b23f67dc 100644
--- a/src/compiler/GF/Compile/ReadFiles.hs
+++ b/src/compiler/GF/Compile/ReadFiles.hs
@@ -23,6 +23,8 @@ module GF.Compile.ReadFiles
gfoFile,gfFile,isGFO,gf2gfo,
getOptionsFromFile) where
+import Prelude hiding (catch)
+import GF.System.Catch
import GF.Infra.UseIO
import GF.Infra.Option
import GF.Infra.Ident
diff --git a/src/compiler/GF/Infra/SIO.hs b/src/compiler/GF/Infra/SIO.hs
index c8355b293..1011b8df4 100644
--- a/src/compiler/GF/Infra/SIO.hs
+++ b/src/compiler/GF/Infra/SIO.hs
@@ -21,7 +21,7 @@ module GF.Infra.SIO(
import Prelude hiding (putStrLn,print)
import Control.Monad(liftM)
import System.IO(Handle,hPutStrLn,hFlush,stdout)
-import System.IO.Error(try)
+import GF.System.Catch(try)
import System.Cmd(system)
import System.Environment(getEnv)
import Control.Concurrent.Chan(newChan,writeChan,getChanContents)
diff --git a/src/compiler/GF/Infra/UseIO.hs b/src/compiler/GF/Infra/UseIO.hs
index b559f0e92..dec2269fd 100644
--- a/src/compiler/GF/Infra/UseIO.hs
+++ b/src/compiler/GF/Infra/UseIO.hs
@@ -15,14 +15,17 @@
module GF.Infra.UseIO where
+import Prelude hiding (catch)
+
import GF.Data.Operations
import GF.Infra.Option
+import GF.System.Catch
import Paths_gf(getDataDir)
import System.Directory
import System.FilePath
import System.IO
-import System.IO.Error
+import System.IO.Error(isUserError,ioeGetErrorString)
import System.Environment
import System.Exit
import System.CPUTime
diff --git a/src/compiler/GF/System/Catch.hs b/src/compiler/GF/System/Catch.hs
new file mode 100644
index 000000000..85d993435
--- /dev/null
+++ b/src/compiler/GF/System/Catch.hs
@@ -0,0 +1,14 @@
+-- | Isolate backwards incompatible library changes to 'catch' and 'try'
+{-# LANGUAGE CPP #-}
+module GF.System.Catch where
+import qualified System.IO.Error as S
+
+#include "cabal_macros.h"
+
+#if MIN_VERSION_base(4,4,0)
+catch = S.catchIOError
+try = S.tryIOError
+#else
+catch = S.catch
+try = S.try
+#endif
diff --git a/src/compiler/GFServer.hs b/src/compiler/GFServer.hs
index fc0dcf347..ac14804c0 100644
--- a/src/compiler/GFServer.hs
+++ b/src/compiler/GFServer.hs
@@ -8,7 +8,8 @@ import Control.Monad.State(StateT(..),get,gets,put)
import Control.Monad.Error(ErrorT(..),Error(..))
import System.Random(randomRIO)
import System.IO(stderr,hPutStrLn)
-import System.IO.Error(try,isAlreadyExistsError)
+import GF.System.Catch(try)
+import System.IO.Error(isAlreadyExistsError)
import System.Directory(doesDirectoryExist,doesFileExist,createDirectory,
setCurrentDirectory,getCurrentDirectory,
getDirectoryContents,removeFile,removeDirectory)