ghc-mod-5.7.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 #

A single GHC command line option.

type IncludeDir = FilePath #

An include directory for modules.

newtype GmlT m a #

Constructors

GmlT 

Fields

Instances

MonadTrans GmlT # 

Methods

lift :: Monad m => m a -> GmlT m a #

MonadTransControl GmlT # 

Associated Types

type StT (GmlT :: (* -> *) -> * -> *) a :: * #

Methods

liftWith :: Monad m => (Run GmlT -> m a) -> GmlT m a #

restoreT :: Monad m => m (StT GmlT a) -> GmlT m a #

MonadBaseControl IO m => MonadBase IO (GmlT m) # 

Methods

liftBase :: IO α -> GmlT m α #

MonadBaseControl IO m => MonadBaseControl IO (GmlT m) # 

Associated Types

type StM (GmlT m :: * -> *) a :: * #

Methods

liftBaseWith :: (RunInBase (GmlT m) IO -> IO a) -> GmlT m a #

restoreM :: StM (GmlT m) a -> GmlT m a #

Monad m => MonadError GhcModError (GmlT m) # 

Methods

throwError :: GhcModError -> GmlT m a #

catchError :: GmlT m a -> (GhcModError -> GmlT m a) -> GmlT m a #

Monad m => Monad (GmlT m) # 

Methods

(>>=) :: GmlT m a -> (a -> GmlT m b) -> GmlT m b #

(>>) :: GmlT m a -> GmlT m b -> GmlT m b #

return :: a -> GmlT m a #

fail :: String -> GmlT m a #

Functor m => Functor (GmlT m) # 

Methods

fmap :: (a -> b) -> GmlT m a -> GmlT m b #

(<$) :: a -> GmlT m b -> GmlT m a #

Monad m => Applicative (GmlT m) # 

Methods

pure :: a -> GmlT m a #

(<*>) :: GmlT m (a -> b) -> GmlT m a -> GmlT m b #

(*>) :: GmlT m a -> GmlT m b -> GmlT m b #

(<*) :: GmlT m a -> GmlT m b -> GmlT m a #

Monad m => MonadPlus (GmlT m) # 

Methods

mzero :: GmlT m a #

mplus :: GmlT m a -> GmlT m a -> GmlT m a #

Monad m => Alternative (GmlT m) # 

Methods

empty :: GmlT m a #

(<|>) :: GmlT m a -> GmlT m a -> GmlT m a #

some :: GmlT m a -> GmlT m [a] #

many :: GmlT m a -> GmlT m [a] #

(Monad m, GmEnv (GhcModT m)) => GmEnv (GmlT m) # 

Methods

gmeAsk :: GmlT m GhcModEnv #

gmeReader :: (GhcModEnv -> a) -> GmlT m a #

gmeLocal :: (GhcModEnv -> GhcModEnv) -> GmlT m a -> GmlT m a #

(Monad m, GmLog (GhcModT m)) => GmLog (GmlT m) # 
Monad m => GmOut (GmlT m) # 

Methods

gmoAsk :: GmlT m GhcModOut #

(Monad m, GmState (GhcModT m)) => GmState (GmlT m) # 

Methods

gmsGet :: GmlT m GhcModState #

gmsPut :: GhcModState -> GmlT m () #

gmsState :: (GhcModState -> (a, GhcModState)) -> GmlT m a #

type StT GmlT a # 
type StT GmlT a = StT GmT a
type StM (GmlT m) a # 
type StM (GmlT m) a = StM (GmT m) a

class MonadIOC m => MonadIO m where #

Minimal complete definition

liftIO

Methods

liftIO :: IO a -> m a #

class Monad m => GmEnv m where #

Minimal complete definition

(gmeAsk | gmeReader), gmeLocal

Methods

gmeAsk :: m GhcModEnv #

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

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

Instances

(Monad m, GmEnv (GhcModT m)) => GmEnv (GmlT m) # 

Methods

gmeAsk :: GmlT m GhcModEnv #

gmeReader :: (GhcModEnv -> a) -> GmlT m a #

gmeLocal :: (GhcModEnv -> GhcModEnv) -> GmlT m a -> GmlT m a #

Monad m => GmEnv (GmT m) # 

Methods

gmeAsk :: GmT m GhcModEnv #

gmeReader :: (GhcModEnv -> a) -> GmT m a #

gmeLocal :: (GhcModEnv -> GhcModEnv) -> GmT m a -> GmT m a #

GmEnv m => GmEnv (GmOutT m) # 

Methods

gmeAsk :: GmOutT m GhcModEnv #

gmeReader :: (GhcModEnv -> a) -> GmOutT m a #

gmeLocal :: (GhcModEnv -> GhcModEnv) -> GmOutT m a -> GmOutT m a #

GmEnv m => GmEnv (JournalT GhcModLog m) # 
GmEnv m => GmEnv (ErrorT GhcModError m) # 
GmEnv m => GmEnv (StateT s m) # 

Methods

gmeAsk :: StateT s m GhcModEnv #

gmeReader :: (GhcModEnv -> a) -> StateT s m a #

gmeLocal :: (GhcModEnv -> GhcModEnv) -> StateT s m a -> StateT s m a #

Various Paths

ghcLibDir :: FilePath #

Obtaining the directory for ghc system libraries.

ghcModExecutable :: IO FilePath #

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)) #

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

setNoWarningFlags :: DynFlags -> DynFlags #

Set DynFlags equivalent to "-w:".

setAllWarningFlags :: DynFlags -> DynFlags #

Set DynFlags equivalent to "-Wall".

Environment, state and logging

data GhcModEnv #

Constructors

GhcModEnv 

class Monad m => GmLog m where #

Minimal complete definition

gmlJournal, gmlHistory, gmlClear

Methods

gmlJournal :: GhcModLog -> m () #

gmlHistory :: m GhcModLog #

gmlClear :: m () #

Instances

Monad utilities

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

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 #

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 #

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] -> (forall gm. GhcMonad gm => DynFlags -> gm DynFlags) -> GmlT m a -> GhcModT m a #

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 #

Get the underlying GHC session

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

Set the underlying GHC session

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

Set the files as targets and load them.

Accessing GhcModEnv and GhcModState

cradle :: GmEnv m => m Cradle #

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

GhcModError

World

data World #

Instances

Eq World # 

Methods

(==) :: World -> World -> Bool #

(/=) :: World -> World -> Bool #

Cabal Helper

data ModulePath #

Constructors

ModulePath 

data GmComponent t eps #

Instances

Functor (GmComponent t) # 

Methods

fmap :: (a -> b) -> GmComponent t a -> GmComponent t b #

(<$) :: a -> GmComponent t b -> GmComponent t a #

Eq eps => Eq (GmComponent t eps) # 

Methods

(==) :: GmComponent t eps -> GmComponent t eps -> Bool #

(/=) :: GmComponent t eps -> GmComponent t eps -> Bool #

Ord eps => Ord (GmComponent t eps) # 

Methods

compare :: GmComponent t eps -> GmComponent t eps -> Ordering #

(<) :: GmComponent t eps -> GmComponent t eps -> Bool #

(<=) :: GmComponent t eps -> GmComponent t eps -> Bool #

(>) :: GmComponent t eps -> GmComponent t eps -> Bool #

(>=) :: GmComponent t eps -> GmComponent t eps -> Bool #

max :: GmComponent t eps -> GmComponent t eps -> GmComponent t eps #

min :: GmComponent t eps -> GmComponent t eps -> GmComponent t eps #

Read eps => Read (GmComponent t eps) # 
Show eps => Show (GmComponent t eps) # 

Methods

showsPrec :: Int -> GmComponent t eps -> ShowS #

show :: GmComponent t eps -> String #

showList :: [GmComponent t eps] -> ShowS #

Generic (GmComponent t eps) # 

Associated Types

type Rep (GmComponent t eps) :: * -> * #

Methods

from :: GmComponent t eps -> Rep (GmComponent t eps) x #

to :: Rep (GmComponent t eps) x -> GmComponent t eps #

Binary eps => Binary (GmComponent t eps) # 

Methods

put :: GmComponent t eps -> Put #

get :: Get (GmComponent t eps) #

putList :: [GmComponent t eps] -> Put #

type Rep (GmComponent t eps) # 

data GmComponentType #

Constructors

GMCRaw 
GMCResolved 

data GmModuleGraph #

Instances

Eq GmModuleGraph # 
Ord GmModuleGraph # 
Read GmModuleGraph # 
Show GmModuleGraph # 
Generic GmModuleGraph # 

Associated Types

type Rep GmModuleGraph :: * -> * #

Monoid GmModuleGraph # 
Binary GmModuleGraph # 
type Rep GmModuleGraph # 
type Rep GmModuleGraph = D1 (MetaData "GmModuleGraph" "Language.Haskell.GhcMod.Types" "ghc-mod-5.7.0.0-KxGeefmr8DvC60AFyUafBd" False) (C1 (MetaCons "GmModuleGraph" PrefixI True) (S1 (MetaSel (Just Symbol "gmgGraph") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Map ModulePath (Set ModulePath)))))

prepareCabalHelper :: (IOish m, GmEnv m, GmOut m, GmLog m) => m () #

Misc stuff

data GHandler m a #

Constructors

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

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

FileMapping