avoid warnings when built with ghc 7.6
This commit is contained in:
parent
91c9ae83f1
commit
92f036fcb4
4 changed files with 13 additions and 12 deletions
|
@ -13,24 +13,27 @@
|
||||||
module Annex.Exception (
|
module Annex.Exception (
|
||||||
bracketIO,
|
bracketIO,
|
||||||
tryAnnex,
|
tryAnnex,
|
||||||
throw,
|
throwAnnex,
|
||||||
catchAnnex,
|
catchAnnex,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Prelude hiding (catch)
|
import qualified "MonadCatchIO-transformers" Control.Monad.CatchIO as M
|
||||||
import "MonadCatchIO-transformers" Control.Monad.CatchIO (bracket, try, throw, catch)
|
import Control.Exception
|
||||||
import Control.Exception hiding (handle, try, throw, bracket, catch)
|
|
||||||
|
|
||||||
import Common.Annex
|
import Common.Annex
|
||||||
|
|
||||||
{- Runs an Annex action, with setup and cleanup both in the IO monad. -}
|
{- Runs an Annex action, with setup and cleanup both in the IO monad. -}
|
||||||
bracketIO :: IO v -> (v -> IO b) -> (v -> Annex a) -> Annex a
|
bracketIO :: IO v -> (v -> IO b) -> (v -> Annex a) -> Annex a
|
||||||
bracketIO setup cleanup go = bracket (liftIO setup) (liftIO . cleanup) go
|
bracketIO setup cleanup go = M.bracket (liftIO setup) (liftIO . cleanup) go
|
||||||
|
|
||||||
{- try in the Annex monad -}
|
{- try in the Annex monad -}
|
||||||
tryAnnex :: Annex a -> Annex (Either SomeException a)
|
tryAnnex :: Annex a -> Annex (Either SomeException a)
|
||||||
tryAnnex = try
|
tryAnnex = M.try
|
||||||
|
|
||||||
|
{- throw in the Annex monad -}
|
||||||
|
throwAnnex :: Exception e => e -> Annex a
|
||||||
|
throwAnnex = M.throw
|
||||||
|
|
||||||
{- catch in the Annex monad -}
|
{- catch in the Annex monad -}
|
||||||
catchAnnex :: Exception e => Annex a -> (e -> Annex a) -> Annex a
|
catchAnnex :: Exception e => Annex a -> (e -> Annex a) -> Annex a
|
||||||
catchAnnex = catch
|
catchAnnex = M.catch
|
||||||
|
|
|
@ -174,7 +174,7 @@ undo file key e = do
|
||||||
liftIO $ nukeFile file
|
liftIO $ nukeFile file
|
||||||
catchAnnex (fromAnnex key file) tryharder
|
catchAnnex (fromAnnex key file) tryharder
|
||||||
logStatus key InfoMissing
|
logStatus key InfoMissing
|
||||||
throw e
|
throwAnnex e
|
||||||
where
|
where
|
||||||
-- fromAnnex could fail if the file ownership is weird
|
-- fromAnnex could fail if the file ownership is weird
|
||||||
tryharder :: IOException -> Annex ()
|
tryharder :: IOException -> Annex ()
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
|
|
||||||
module Utility.Exception where
|
module Utility.Exception where
|
||||||
|
|
||||||
import Prelude hiding (catch)
|
|
||||||
import Control.Exception
|
import Control.Exception
|
||||||
|
import qualified Control.Exception as E
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import System.IO.Error (isDoesNotExistError)
|
import System.IO.Error (isDoesNotExistError)
|
||||||
|
@ -33,7 +33,7 @@ catchMsgIO a = either (Left . show) Right <$> tryIO a
|
||||||
|
|
||||||
{- catch specialized for IO errors only -}
|
{- catch specialized for IO errors only -}
|
||||||
catchIO :: IO a -> (IOException -> IO a) -> IO a
|
catchIO :: IO a -> (IOException -> IO a) -> IO a
|
||||||
catchIO = catch
|
catchIO = E.catch
|
||||||
|
|
||||||
{- try specialized for IO errors only -}
|
{- try specialized for IO errors only -}
|
||||||
tryIO :: IO a -> IO (Either IOException a)
|
tryIO :: IO a -> IO (Either IOException a)
|
||||||
|
|
|
@ -20,8 +20,6 @@ module Utility.Mounts (
|
||||||
import Control.Monad
|
import Control.Monad
|
||||||
import Foreign
|
import Foreign
|
||||||
import Foreign.C
|
import Foreign.C
|
||||||
import GHC.IO hiding (finally, bracket)
|
|
||||||
import Prelude hiding (catch)
|
|
||||||
#include "libmounts.h"
|
#include "libmounts.h"
|
||||||
#else
|
#else
|
||||||
import Utility.Exception
|
import Utility.Exception
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue