Skip to content
Snippets Groups Projects
Commit 4c329396 authored by Adam Bergmark's avatar Adam Bergmark
Browse files

Always define ExceptT instances using transformers-compat.

parent 943e6561
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@ library
base >= 4.3 && < 5,
stm >= 2.2 && < 3,
transformers >= 0.2 && < 0.5,
transformers-compat >= 0.3 && < 0.5,
mtl >= 2.0 && < 2.3
exposed-modules:
......
......@@ -92,9 +92,7 @@ import Control.Monad.STM (STM)
import Control.Monad.Trans.List (ListT(..), runListT)
import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT)
import Control.Monad.Trans.Error (ErrorT(..), Error, runErrorT)
#if MIN_VERSION_transformers(0,4,0)
import Control.Monad.Trans.Except (ExceptT(..), runExceptT)
#endif
import Control.Monad.Trans.Cont (ContT)
import Control.Monad.Trans.Identity
import Control.Monad.Reader as Reader
......@@ -320,14 +318,12 @@ instance (Error e, MonadThrow m) => MonadThrow (ErrorT e m) where
instance (Error e, MonadCatch m) => MonadCatch (ErrorT e m) where
catch (ErrorT m) f = ErrorT $ catch m (runErrorT . f)
#if MIN_VERSION_transformers(0,4,0)
-- | Throws exceptions into the base monad.
instance MonadThrow m => MonadThrow (ExceptT e m) where
throwM = lift . throwM
-- | Catches exceptions from the base monad.
instance MonadCatch m => MonadCatch (ExceptT e m) where
catch (ExceptT m) f = ExceptT $ catch m (runExceptT . f)
#endif
instance MonadThrow m => MonadThrow (ContT r m) where
throwM = lift . throwM
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment