hie-bios-0.8.0: Set up a GHC API session
Safe HaskellNone
LanguageHaskell2010

HIE.Bios.Ghc.Gap

Description

All the CPP for GHC version compability should live in this module.

Synopsis

Documentation

Warnings, Doc Compat

data PprStyle #

Instances

Instances details
Outputable PprStyle 
Instance details

Defined in Outputable

Argument parsing

Ghc Monad

modifySession :: GhcMonad m => (HscEnv -> HscEnv) -> m () #

Set the current session to the result of applying the current session to the argument.

reflectGhc :: Ghc a -> Session -> IO a #

Reflect a computation in the Ghc monad into the IO monad.

You can use this to call functions returning an action in the Ghc monad inside an IO action. This is needed for some (too restrictive) callback arguments of some library functions:

libFunc :: String -> (Int -> IO a) -> IO a
ghcFunc :: Int -> Ghc a

ghcFuncUsingLibFunc :: String -> Ghc a -> Ghc a
ghcFuncUsingLibFunc str =
  reifyGhc $ \s ->
    libFunc $ \i -> do
      reflectGhc (ghcFunc i) s

data Session #

The Session is a handle to the complete state of a compilation session. A compilation session consists of a set of modules constituting the current program or library, the context for interactive evaluation, and various caches.

Constructors

Session !(IORef HscEnv) 

Hsc Monad

Driver compat

HscEnv Compat

getLogger :: HscEnv -> Logger Source #

AST compat

Exceptions

catch :: (MonadCatch m, Exception e) => m a -> (e -> m a) -> m a Source #

bracket :: ExceptionMonad m => m a -> (a -> m c) -> (a -> m b) -> m b Source #

handle :: (ExceptionMonad m, Exception e) => (e -> m a) -> m a -> m a Source #

Doc Gap functions

DynFlags compat

updOptLevel :: Int -> DynFlags -> DynFlags #

Sets the DynFlags to be appropriate to the optimisation level

Platform constants

misc

getModuleName :: (a, b) -> a Source #

getTyThing :: (a, b, c, d, e) -> a Source #

fixInfo :: (a, b, c, d, e) -> (a, b, c, d) Source #

data FrontendResult #

FrontendResult describes the result of running the frontend of a Haskell module. Usually, you'll get a FrontendTypecheck, since running the frontend involves typechecking a program, but for an hs-boot merge you'll just get a ModIface, since no actual typechecking occurred.

This data type really should be in HscTypes, but it needs to have a TcGblEnv which is only defined here.

data Hsc a #

Instances

Instances details
Monad Hsc 
Instance details

Defined in HscTypes

Methods

(>>=) :: Hsc a -> (a -> Hsc b) -> Hsc b #

(>>) :: Hsc a -> Hsc b -> Hsc b #

return :: a -> Hsc a #

Functor Hsc 
Instance details

Defined in HscTypes

Methods

fmap :: (a -> b) -> Hsc a -> Hsc b #

(<$) :: a -> Hsc b -> Hsc a #

Applicative Hsc 
Instance details

Defined in HscTypes

Methods

pure :: a -> Hsc a #

(<*>) :: Hsc (a -> b) -> Hsc a -> Hsc b #

liftA2 :: (a -> b -> c) -> Hsc a -> Hsc b -> Hsc c #

(*>) :: Hsc a -> Hsc b -> Hsc b #

(<*) :: Hsc a -> Hsc b -> Hsc a #

MonadIO Hsc 
Instance details

Defined in HscTypes

Methods

liftIO :: IO a -> Hsc a #

HasDynFlags Hsc 
Instance details

Defined in HscTypes

mapMG :: (ModSummary -> ModSummary) -> ModuleGraph -> ModuleGraph #

Map a function f over all the ModSummaries. To preserve invariants f can't change the isBoot status.