Fix instances for GHC<7.8

This commit is contained in:
Daniel Gröber 2016-01-04 01:10:04 +01:00
parent 67c9538f30
commit d2f7df21df
3 changed files with 15 additions and 27 deletions

View File

@ -26,7 +26,3 @@
-- RWST doen't have a MonadIO instance before ghc 7.8 -- RWST doen't have a MonadIO instance before ghc 7.8
#define MONADIO_INSTANCES 1 #define MONADIO_INSTANCES 1
#endif #endif
#if DIFFERENT_MONADIO
import Data.Monoid (Monoid)
#endif

View File

@ -40,15 +40,9 @@ import Control.Monad.Trans.Class (MonadTrans(..))
import Control.Monad.Trans.Control import Control.Monad.Trans.Control
import Control.Monad.Base (MonadBase(..), liftBase) import Control.Monad.Base (MonadBase(..), liftBase)
#if DIFFERENT_MONADIO
import qualified MonadUtils as GHC (MonadIO(..))
#endif
import qualified Control.Monad.IO.Class as MTL
import Data.IORef import Data.IORef
import Prelude import Prelude
type GhcModT m = GmT (GmOutT m) type GhcModT m = GmT (GmOutT m)
newtype GmOutT m a = GmOutT { newtype GmOutT m a = GmOutT {
@ -59,10 +53,6 @@ newtype GmOutT m a = GmOutT {
, Monad , Monad
, MonadPlus , MonadPlus
, MonadTrans , MonadTrans
, MTL.MonadIO
#if DIFFERENT_MONADIO
, GHC.MonadIO
#endif
) )
newtype GmT m a = GmT { newtype GmT m a = GmT {
@ -75,10 +65,6 @@ newtype GmT m a = GmT {
, Alternative , Alternative
, Monad , Monad
, MonadPlus , MonadPlus
, MTL.MonadIO
#if DIFFERENT_MONADIO
, GHC.MonadIO
#endif
, MonadError GhcModError , MonadError GhcModError
) )
@ -88,10 +74,6 @@ newtype GmlT m a = GmlT { unGmlT :: GhcModT m a }
, Alternative , Alternative
, Monad , Monad
, MonadPlus , MonadPlus
, MTL.MonadIO
#if DIFFERENT_MONADIO
, GHC.MonadIO
#endif
, MonadError GhcModError , MonadError GhcModError
) )
@ -99,10 +81,6 @@ newtype LightGhc a = LightGhc { unLightGhc :: ReaderT (IORef HscEnv) IO a }
deriving ( Functor deriving ( Functor
, Applicative , Applicative
, Monad , Monad
, MTL.MonadIO
#if DIFFERENT_MONADIO
, GHC.MonadIO
#endif
) )
-- GmOutT ---------------------------------------- -- GmOutT ----------------------------------------

View File

@ -14,7 +14,9 @@
-- You should have received a copy of the GNU Affero General Public License -- You should have received a copy of the GNU Affero General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>. -- along with this program. If not, see <http://www.gnu.org/licenses/>.
{-# LANGUAGE CPP #-} {-# LANGUAGE CPP, UndecidableInstances, StandaloneDeriving #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-orphans #-}
module Language.Haskell.GhcMod.Monad.Orphans where module Language.Haskell.GhcMod.Monad.Orphans where
@ -23,6 +25,9 @@ module Language.Haskell.GhcMod.Monad.Orphans where
import Language.Haskell.GhcMod.Types import Language.Haskell.GhcMod.Types
import Language.Haskell.GhcMod.Monad.Newtypes import Language.Haskell.GhcMod.Monad.Newtypes
#if DIFFERENT_MONADIO
import qualified MonadUtils as GHC (MonadIO(..))
#endif
import qualified Control.Monad.IO.Class as MTL import qualified Control.Monad.IO.Class as MTL
import Control.Monad.Reader (ReaderT(..)) import Control.Monad.Reader (ReaderT(..))
@ -45,8 +50,17 @@ instance MTL.MonadIO m => GHC.MonadIO (JournalT x m) where
liftIO = MTL.liftIO liftIO = MTL.liftIO
instance MTL.MonadIO m => GHC.MonadIO (MaybeT m) where instance MTL.MonadIO m => GHC.MonadIO (MaybeT m) where
liftIO = MTL.liftIO liftIO = MTL.liftIO
deriving instance MTL.MonadIO m => GHC.MonadIO (GmOutT m)
deriving instance MTL.MonadIO m => GHC.MonadIO (GmT m)
deriving instance MTL.MonadIO m => GHC.MonadIO (GmlT m)
deriving instance GHC.MonadIO LightGhc
#endif #endif
deriving instance MTL.MonadIO m => MTL.MonadIO (GmOutT m)
deriving instance MTL.MonadIO m => MTL.MonadIO (GmT m)
deriving instance MTL.MonadIO m => MTL.MonadIO (GmlT m)
deriving instance MTL.MonadIO LightGhc
instance MonadIO IO where instance MonadIO IO where
liftIO = id liftIO = id
instance MonadIO m => MonadIO (ReaderT x m) where instance MonadIO m => MonadIO (ReaderT x m) where