hsdev-0.1.8.1: Haskell development library and tool with support of autocompletion, symbol info, go to declaration, find references etc.

Safe HaskellNone
LanguageHaskell98

HsDev.Tools.Ghc.Worker

Contents

Synopsis

Workers

ghcWorker :: MonadLog m => [String] -> GhcM () -> m (Worker GhcM) Source

Ghc worker. Pass options and initializer action

ghciWorker :: MonadLog m => m (Worker GhcM) Source

Interpreter worker is worker with preludeModules loaded

Initializers and actions

ghcRun :: GhcMonad m => [String] -> m a -> m a Source

Run ghc

withFlags :: GhcMonad m => m a -> m a Source

Alter DynFlags temporary

modifyFlags :: GhcMonad m => (DynFlags -> DynFlags) -> m () Source

Update DynFlags

addCmdOpts :: (MonadLog m, GhcMonad m) => [String] -> m () Source

Add options without reinit session

setCmdOpts :: (MonadLog m, GhcMonad m) => [String] -> m () Source

Set options after session reinit

importModules :: GhcMonad m => [String] -> m () Source

Import some modules

preludeModules :: [String] Source

Default interpreter modules

evaluate :: GhcMonad m => String -> m String Source

Evaluate expression

clearTargets :: GhcMonad m => m () Source

Clear loaded targets

makeTarget :: GhcMonad m => String -> Maybe String -> m Target Source

Make target with its source code optional

loadTargets :: GhcMonad m => [Target] -> m () Source

Load all targets

Utils

listPackages :: GhcMonad m => m [ModulePackage] Source

Get list of installed packages

spanRegion :: SrcSpan -> Region Source

Get region of SrcSpan

withCurrentDirectory :: GhcMonad m => FilePath -> m a -> m a Source

Set current directory and restore it after action

logToChan :: Chan (Note OutputMessage) -> DynFlags -> Severity -> SrcSpan -> PprStyle -> SDoc -> IO () Source

Log ghc warnings and errors as to chan You may have to apply recalcTabs on result notes

logToNull :: DynFlags -> Severity -> SrcSpan -> PprStyle -> SDoc -> IO () Source

Don't log ghc warnings and errors

data Ghc a :: * -> *

A minimal implementation of a GhcMonad. If you need a custom monad, e.g., to maintain additional state consider wrapping this monad or using GhcT.