diff options
| author | Sean Whitton <spwhitton@spwhitton.name> | 2016-06-19 20:59:03 +0900 |
|---|---|---|
| committer | Sean Whitton <spwhitton@spwhitton.name> | 2016-06-19 21:02:45 +0900 |
| commit | ffcf9ca8c438a7f3a5f12623859199b5b12b6255 (patch) | |
| tree | 547f7fe7f13c0f043d1619d0e4930364ce0d8023 /src | |
| parent | d31650d667a35808051dab6db1daf3ae1f905b57 (diff) | |
fix Propellor/Exception.hs for GHC 7.6.3
Diffstat (limited to 'src')
| -rw-r--r-- | src/Propellor/Exception.hs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Propellor/Exception.hs b/src/Propellor/Exception.hs index 3ab783bf..c02fa61a 100644 --- a/src/Propellor/Exception.hs +++ b/src/Propellor/Exception.hs @@ -10,10 +10,15 @@ import Utility.Exception import Control.Exception (AsyncException) import Control.Monad.Catch import Control.Monad.IO.Class (MonadIO) +import Control.Applicative +import Prelude -- | Catches all exceptions (except for `StopPropellorException` and -- `AsyncException`) and returns FailedChange. -catchPropellor :: (MonadIO m, MonadCatch m) => m Result -> m Result +catchPropellor + :: (Applicative m, MonadIO m, MonadCatch m) + => m Result + -> m Result catchPropellor a = either err return =<< tryPropellor a where err e = warningMessage (show e) >> return FailedChange @@ -27,5 +32,8 @@ catchPropellor' a onerr = a `catches` -- | Catches all exceptions (except for `StopPropellorException` and -- `AsyncException`). -tryPropellor :: MonadCatch m => m a -> m (Either SomeException a) +tryPropellor + :: (Functor m, Applicative m, MonadCatch m) + => m a + -> m (Either SomeException a) tryPropellor a = (Right <$> a) `catchPropellor'` (pure . Left) |
