module GHC.Compat
(module GHC
,module GHC.Paths
,module Outputable
,module Packages
,module BasicTypes
,module DynFlags
,module GhcMonad
,module SrcLoc
,module FastString
,module MonadUtils
,module Exception
,module HscTypes
,parseImportDecl
,typeKind
,setContext
,defaultErrorHandler
,showSDocForUser
,setLogAction
,showSDoc
,getInfo
,addToContext)
where
import BasicTypes hiding (Version)
import qualified Control.Monad.Trans as Trans
import qualified DynFlags
import ErrUtils
import Exception
import FastString
import qualified GHC
import GHC.Paths
import GhcMonad
import HscTypes
import MonadUtils
import qualified Outputable
import Packages
import SrcLoc
import System.IO
import DynFlags
hiding (LogAction)
import Outputable
hiding (showSDocForUser
,showSDoc)
import GHC
hiding (parseImportDecl
,typeKind
,setContext
,defaultErrorHandler
,getInfo)
typeKind :: GhcMonad m => String -> m Kind
#if __GLASGOW_HASKELL__ == 704
typeKind expr = fmap snd (GHC.typeKind True expr)
#endif
#if __GLASGOW_HASKELL__ == 706
typeKind expr = fmap snd (GHC.typeKind True expr)
#endif
#if __GLASGOW_HASKELL__ == 708
typeKind expr = fmap snd (GHC.typeKind True expr)
#endif
parseImportDecl :: GhcMonad m => String -> m (ImportDecl RdrName)
#if __GLASGOW_HASKELL__ == 704
parseImportDecl = GHC.parseImportDecl
#endif
#if __GLASGOW_HASKELL__ == 706
parseImportDecl = GHC.parseImportDecl
#endif
#if __GLASGOW_HASKELL__ == 708
parseImportDecl = GHC.parseImportDecl
#endif
setContext :: GhcMonad m => [ImportDecl RdrName] -> m ()
#if __GLASGOW_HASKELL__ == 704
setContext = GHC.setContext . map IIDecl
#endif
#if __GLASGOW_HASKELL__ == 706
setContext = GHC.setContext . map IIDecl
#endif
#if __GLASGOW_HASKELL__ == 708
setContext = GHC.setContext . map IIDecl
#endif
addToContext :: GhcMonad m => ImportDecl RdrName -> m ()
#if __GLASGOW_HASKELL__ == 704
addToContext i =
do ctx <- getContext
GHC.setContext (IIDecl i : ctx)
#endif
#if __GLASGOW_HASKELL__ == 706
addToContext i =
do ctx <- getContext
GHC.setContext (IIDecl i : ctx)
#endif
#if __GLASGOW_HASKELL__ == 708
addToContext i =
do ctx <- getContext
GHC.setContext (IIDecl i : ctx)
#endif
defaultErrorHandler :: (MonadIO m,ExceptionMonad m) => m a -> m a
#if __GLASGOW_HASKELL__ == 704
defaultErrorHandler = GHC.defaultErrorHandler defaultLogAction
#endif
#if __GLASGOW_HASKELL__ == 706
defaultErrorHandler = GHC.defaultErrorHandler putStrLn (FlushOut (hFlush stdout))
#endif
#if __GLASGOW_HASKELL__ == 708
defaultErrorHandler = GHC.defaultErrorHandler putStrLn (FlushOut (hFlush stdout))
#endif
showSDocForUser :: DynFlags -> PrintUnqualified -> SDoc -> String
#if __GLASGOW_HASKELL__ == 704
showSDocForUser _ = Outputable.showSDocForUser
#endif
#if __GLASGOW_HASKELL__ == 706
showSDocForUser = Outputable.showSDocForUser
#endif
#if __GLASGOW_HASKELL__ == 708
showSDocForUser = Outputable.showSDocForUser
#endif
#if __GLASGOW_HASKELL__ == 704
type LogAction = DynFlags -> Severity -> SrcSpan -> PprStyle -> Message -> IO ()
#endif
#if __GLASGOW_HASKELL__ == 706
type LogAction = DynFlags -> Severity -> SrcSpan -> PprStyle -> MsgDoc -> IO ()
#endif
#if __GLASGOW_HASKELL__ == 708
type LogAction = DynFlags -> Severity -> SrcSpan -> PprStyle -> MsgDoc -> IO ()
#endif
setLogAction :: GhcMonad m => LogAction -> m ()
#if __GLASGOW_HASKELL__ == 704
setLogAction logger =
do dflags <- getSessionDynFlags
setSessionDynFlags dflags { log_action = logger dflags }
return ()
#endif
#if __GLASGOW_HASKELL__ == 706
setLogAction logger =
do dflags <- getSessionDynFlags
setSessionDynFlags dflags { log_action = logger }
return ()
#endif
#if __GLASGOW_HASKELL__ == 708
setLogAction logger =
do dflags <- getSessionDynFlags
setSessionDynFlags dflags { log_action = logger }
return ()
#endif
showSDoc :: DynFlags -> SDoc -> String
#if __GLASGOW_HASKELL__ == 704
showSDoc _ = Outputable.showSDoc
#endif
#if __GLASGOW_HASKELL__ == 706
showSDoc = Outputable.showSDoc
#endif
#if __GLASGOW_HASKELL__ == 708
showSDoc = Outputable.showSDoc
#endif
#if __GLASGOW_HASKELL__ == 704
type SomeInstance = Instance
#endif
#if __GLASGOW_HASKELL__ == 706
type SomeInstance = ClsInst
#endif
#if __GLASGOW_HASKELL__ == 708
type SomeInstance = ClsInst
#endif
getInfo :: GhcMonad m => Name -> m (Maybe (TyThing, Fixity, [SomeInstance]))
#if __GLASGOW_HASKELL__ == 702
getInfo = GHC.getInfo
#endif
#if __GLASGOW_HASKELL__ == 704
getInfo = GHC.getInfo
#endif
#if __GLASGOW_HASKELL__ == 706
getInfo = GHC.getInfo
#endif
#if __GLASGOW_HASKELL__ == 708
getInfo = fmap (fmap (\(a,b,c,d) -> (a,b,c))) . GHC.getInfo False
#endif
#if __GLASGOW_HASKELL__ == 704
instance Trans.MonadIO Ghc where liftIO = GhcMonad.liftIO
#endif
#if __GLASGOW_HASKELL__ == 706
instance Trans.MonadIO Ghc where liftIO = GhcMonad.liftIO
#endif