ghc-mod-5.3.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 Package = (PackageBaseName, PackageVersion, PackageId) Source

A package's name, verson and id.

type PackageBaseName = String Source

A package name.

type PackageVersion = String Source

A package version.

type PackageId = String Source

A package id.

type IncludeDir = FilePath Source

An include directory for modules.

newtype GmlT m a Source

Constructors

GmlT 

Fields

unGmlT :: GhcModT m a
 

class MonadIOC m => MonadIO m where Source

Methods

liftIO :: IO a -> m a Source

Instances

MonadIO IO 
MonadIO m => MonadIO (MaybeT m) 
MonadIOC m => MonadIO (GmlT m) 
MonadIOC m => MonadIO (GhcModT m) 
MonadIO m => MonadIO (JournalT x m) 
(Error e, MonadIO m) => MonadIO (ErrorT e m) 
MonadIO m => MonadIO (ReaderT x m) 
MonadIO m => MonadIO (StateT x m) 

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

Instances

Monad m => GmEnv (GmlT m) 
Monad m => GmEnv (GhcModT m) 
GmEnv m => GmEnv (StateT s m) 

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) => (DynFlags -> DynFlags) -> m a -> m (Either String (String, a)) Source

Set the session flag (e.g. "-Wall" or "-w:") then executes a body. 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 

Fields

gmOptions :: Options
 
gmCradle :: Cradle
 
gmOutput :: GmOutput
 

class Monad m => GmLog m where Source

Instances

Monad m => GmLog (GmlT m) 
Monad m => GmLog (GhcModT m) 
Monad m => GmLog (JournalT GhcModLog m) 
(Monad m, GmLog m) => GmLog (ReaderT r m) 
(Monad m, GmLog m) => GmLog (StateT s m) 

Monad utilities

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.

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

Set the files as targets and load them.

Accessing GhcModEnv and GhcModState

setCompilerMode :: GmState m => CompilerMode -> m () Source

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