summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Whitton2016-06-21 18:03:56 +0900
committerSean Whitton2016-06-21 18:03:56 +0900
commit522751f8b297976932b6454bb6d974e1bb5c3049 (patch)
tree43716d676e297a906744222786d9b9f5bf5e3469
parent9ae2b69b2a388fdb9d18f64f4a813089768c0d69 (diff)
Revert "fix Propellor/Exception.hs for GHC 7.6.3"
This reverts commit ffcf9ca8c438a7f3a5f12623859199b5b12b6255. FĂ©lix fixed this more comprehensively.
-rw-r--r--src/Propellor/Exception.hs12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/Propellor/Exception.hs b/src/Propellor/Exception.hs
index c02fa61a..3ab783bf 100644
--- a/src/Propellor/Exception.hs
+++ b/src/Propellor/Exception.hs
@@ -10,15 +10,10 @@ 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
- :: (Applicative m, MonadIO m, MonadCatch m)
- => m Result
- -> m Result
+catchPropellor :: (MonadIO m, MonadCatch m) => m Result -> m Result
catchPropellor a = either err return =<< tryPropellor a
where
err e = warningMessage (show e) >> return FailedChange
@@ -32,8 +27,5 @@ catchPropellor' a onerr = a `catches`
-- | Catches all exceptions (except for `StopPropellorException` and
-- `AsyncException`).
-tryPropellor
- :: (Functor m, Applicative m, MonadCatch m)
- => m a
- -> m (Either SomeException a)
+tryPropellor :: MonadCatch m => m a -> m (Either SomeException a)
tryPropellor a = (Right <$> a) `catchPropellor'` (pure . Left)