forked from GitHub/gf-core
Eliminate warnings about deprecated use of catch and try
This is also needed for compatibility with GHC 7.6.
This commit is contained in:
5
gf.cabal
5
gf.cabal
@@ -95,7 +95,7 @@ library
|
||||
Data.Binary.IEEE754
|
||||
|
||||
executable gf
|
||||
build-depends: base >= 4.2,
|
||||
build-depends: base >= 4.2 && <5,
|
||||
array,
|
||||
containers,
|
||||
bytestring,
|
||||
@@ -146,8 +146,9 @@ executable gf
|
||||
GF.Infra.Option
|
||||
GF.Infra.UseIO
|
||||
GF.Infra.CheckM
|
||||
GF.System.Signal
|
||||
GF.System.Catch
|
||||
GF.System.Console
|
||||
GF.System.Signal
|
||||
GF.Command.Commands
|
||||
GF.Command.Interpreter
|
||||
GF.Command.Abstract
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
14
src/compiler/GF/System/Catch.hs
Normal file
14
src/compiler/GF/System/Catch.hs
Normal file
@@ -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
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user