ghc-mod-5.5.0.0: Happy Haskell Programming

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.GhcMod.Internal

Contents

Description

Low level access to the ghc-mod library.

Synopsis

Types

type GHCOption = String Source

A single GHC command line option.

type IncludeDir = FilePath Source

An include directory for modules.

class MonadIOC m => MonadIO m where Source

Methods

liftIO :: IO a -> m a Source

class Monad m => GmEnv m where Source

Minimal complete definition

(gmeAsk | gmeReader), gmeLocal

Methods

gmeAsk :: m GhcModEnv Source

gmeReader :: (GhcModEnv -> a) -> m a Source

gmeLocal :: (GhcModEnv -> GhcModEnv) -> m a -> m a Source

Various Paths

ghcLibDir :: FilePath Source

Obtaining the directory for ghc system libraries.

ghcModExecutable :: IO FilePath Source

Returns the path to the currently running ghc-mod executable. With ghc<7.6 this is a guess but >=7.6 uses getExecutablePath.

Logging

withLogger :: (GmGhc m, GmEnv m, GmOut m, GmState m) => (DynFlags -> DynFlags) -> m a -> m (Either String (String, a)) Source

Logged messages are returned as String. Right is success and Left is failure.

setNoWarningFlags :: DynFlags -> DynFlags Source

Set DynFlags equivalent to "-w:".

setAllWarningFlags :: DynFlags -> DynFlags Source

Set DynFlags equivalent to "-Wall".

Environment, state and logging

data GhcModEnv Source

Constructors

GhcModEnv 

class Monad m => GmLog m where Source

Instances

(Monad m, GmLog m) => GmLog (MaybeT m) Source 
(Monad m, GmLog (GhcModT m)) => GmLog (GmlT m) Source 
Monad m => GmLog (GmT m) Source 
GmLog m => GmLog (GmOutT m) Source 
Monad m => GmLog (LogDiscardT m) Source 
Monad m => GmLog (JournalT GhcModLog m) Source 
(Monad m, GmLog m) => GmLog (ReaderT r m) Source 
(Monad m, GmLog m) => GmLog (StateT s m) Source 
(Monad m, GmLog m, Error e) => GmLog (ErrorT e m) Source 

Monad utilities

runGhcModT' :: IOish m => GhcModEnv -> GhcModState -> GhcModT m a -> GmOutT m (Either GhcModError (a, GhcModState), GhcModLog) Source

Run a computation inside GhcModT providing the RWST environment and initial state. This is a low level function, use it only if you know what to do with GhcModEnv and GhcModState.

You should probably look at runGhcModT instead.

hoistGhcModT :: IOish m => (Either GhcModError a, GhcModLog) -> GhcModT m a Source

hoistGhcModT result. Embed a GhcModT computation's result into a GhcModT computation. Note that if the computation that returned result modified the state part of GhcModT this cannot be restored.

runGmlT :: IOish m => [Either FilePath ModuleName] -> GmlT m a -> GhcModT m a Source

Run a GmlT action (i.e. a function in the GhcMonad) in the context of certain files or modules

runGmlT' :: IOish m => [Either FilePath ModuleName] -> (DynFlags -> Ghc DynFlags) -> GmlT m a -> GhcModT m a Source

Run a GmlT action (i.e. a function in the GhcMonad) in the context of certain files or modules, with updated GHC flags

gmlGetSession :: (MonadIO m, MonadBaseControl IO m) => GmlT m HscEnv Source

Get the underlying GHC session

gmlSetSession :: (MonadIO m, MonadBaseControl IO m) => HscEnv -> GmlT m () Source

Set the underlying GHC session

loadTargets :: IOish m => [GHCOption] -> [FilePath] -> GmlT m () Source

Set the files as targets and load them.

Accessing GhcModEnv and GhcModState

withOptions :: GmEnv m => (Options -> Options) -> m a -> m a Source

GhcModError

World

data World Source

Instances

Cabal Helper

Misc stuff

data GHandler m a Source

Constructors

forall e . Exception e => GHandler (e -> m a) 

gcatches :: (MonadIO m, ExceptionMonad m) => m a -> [GHandler m a] -> m a Source

FileMapping