summaryrefslogtreecommitdiff
path: root/compiler/main/GhcMonad.hs
diff options
context:
space:
mode:
authorSimon Peyton Jones <simonpj@microsoft.com>2015-01-05 16:57:01 +0000
committerSimon Peyton Jones <simonpj@microsoft.com>2015-01-05 17:00:05 +0000
commit0b3f53fb8d86278ead96ea08bedd8990d3256dc4 (patch)
treed3ae62380f95ab44b711a4d4a7b8eb9630746069 /compiler/main/GhcMonad.hs
parentd6c8da69ed75f0a046bfcf779e71a4ecd2dab106 (diff)
downloadhaskell-wip/redundant-constraints.tar.gz
Remove redundant constraints in the compiler itself, found by -fwarn-redundant-constraintswip/redundant-constraints
Diffstat (limited to 'compiler/main/GhcMonad.hs')
-rw-r--r--compiler/main/GhcMonad.hs17
1 files changed, 13 insertions, 4 deletions
diff --git a/compiler/main/GhcMonad.hs b/compiler/main/GhcMonad.hs
index ebcaf368e1..6a3e107801 100644
--- a/compiler/main/GhcMonad.hs
+++ b/compiler/main/GhcMonad.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE RankNTypes #-}
+{-# LANGUAGE CPP, RankNTypes #-}
{-# OPTIONS_GHC -funbox-strict-fields #-}
-- -----------------------------------------------------------------------------
--
@@ -156,7 +156,8 @@ reifyGhc act = Ghc $ act
--
-- Note that the wrapped monad must support IO and handling of exceptions.
newtype GhcT m a = GhcT { unGhcT :: Session -> m a }
-liftGhcT :: Monad m => m a -> GhcT m a
+
+liftGhcT :: m a -> GhcT m a
liftGhcT m = GhcT $ \_ -> m
instance Functor m => Functor (GhcT m) where
@@ -183,10 +184,18 @@ instance ExceptionMonad m => ExceptionMonad (GhcT m) where
in
unGhcT (f g_restore) s
-instance (Functor m, ExceptionMonad m, MonadIO m) => HasDynFlags (GhcT m) where
+#if __GLASGOW_HASKELL__ < 710
+instance (ExceptionMonad m, Functor m) => HasDynFlags (GhcT m) where
+#else
+instance (ExceptionMonad m) => HasDynFlags (GhcT m) where
+#endif
getDynFlags = getSessionDynFlags
-instance (Functor m, ExceptionMonad m, MonadIO m) => GhcMonad (GhcT m) where
+#if __GLASGOW_HASKELL__ < 710
+instance (ExceptionMonad m, Functor m) => GhcMonad (GhcT m) where
+#else
+instance (ExceptionMonad m) => GhcMonad (GhcT m) where
+#endif
getSession = GhcT $ \(Session r) -> liftIO $ readIORef r
setSession s' = GhcT $ \(Session r) -> liftIO $ writeIORef r s'