summaryrefslogtreecommitdiff
path: root/compiler/GHC/Driver/Monad.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Driver/Monad.hs')
-rw-r--r--compiler/GHC/Driver/Monad.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/GHC/Driver/Monad.hs b/compiler/GHC/Driver/Monad.hs
index 3825757ac6..8e09320cda 100644
--- a/compiler/GHC/Driver/Monad.hs
+++ b/compiler/GHC/Driver/Monad.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, DeriveFunctor, RankNTypes #-}
+{-# LANGUAGE CPP, DeriveFunctor, RankNTypes, DerivingVia #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
-- -----------------------------------------------------------------------------
--
@@ -30,6 +30,8 @@ import GHC.Driver.Types
import GHC.Driver.Session
import Exception
import ErrUtils
+import Control.Monad.Catch(MonadMask, MonadCatch, MonadThrow)
+import Control.Monad.Trans.Reader
import Control.Monad
import Data.IORef
@@ -91,6 +93,9 @@ logWarnings warns = do
-- e.g., to maintain additional state consider wrapping this monad or using
-- 'GhcT'.
newtype Ghc a = Ghc { unGhc :: Session -> IO a } deriving (Functor)
+ deriving MonadCatch via (ReaderT Session IO)
+ deriving MonadThrow via (ReaderT Session IO)
+ deriving MonadMask via (ReaderT Session IO)
-- | The Session is a handle to the complete state of a compilation
-- session. A compilation session consists of a set of modules