ghc-mod-5.5.0.0: Happy Haskell Programming

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.GhcMod.Monad.Types

Contents

Synopsis

Monad Types

type GhcModT m = GmT (GmOutT m) Source

type GmGhc m = (IOish m, GhcMonad m) Source

type IOish m = (Functor m, MonadIO m, MonadBaseControl IO m, ExceptionMonad m) Source

A constraint alias (-XConstraintKinds) to make functions dealing with GhcModT somewhat cleaner.

Basicially an IOish m => m is a Monad supporting arbitrary IO and exception handling. Usually this will simply be IO but we parametrise it in the exported API so users have the option to use a custom inner monad.

Environment, state and logging

data GhcModEnv Source

Constructors

GhcModEnv 

Accessing GhcModEnv, GhcModState and GhcModLog

data GhcModError Source

Constructors

GMENoMsg

Unknown error

GMEString String

Some Error with a message. These are produced mostly by fail calls on GhcModT.

GMECabalConfigure GhcModError

Configuring a cabal project failed.

GMEStackConfigure GhcModError

Configuring a stack project failed.

GMEStackBootstrap GhcModError

Bootstrapping stack environment failed (process exited with failure)

GMECabalCompAssignment [(Either FilePath ModuleName, Set ChComponentName)]

Could not find a consistent component assignment for modules

GMEProcess String String [String] (Either Int GhcModError)

Launching an operating system process failed. Fields in order: function, command, arguments, (stdout, stderr, exitcode)

GMENoCabalFile

No cabal file found.

GMETooManyCabalFiles [FilePath]

Too many cabal files found.

type Gm m = (GmEnv m, GmState m, GmLog m, GmOut m) 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

class Monad m => GmState m where Source

Minimal complete definition

gmsState | gmsGet, gmsPut

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 

class Monad m => GmOut m where Source

Methods

gmoAsk :: m GhcModOut Source

Instances

GmOut m => GmOut (MaybeT m) Source 
Monad m => GmOut (GmlT m) Source 
GmOut m => GmOut (GmT m) Source 
Monad m => GmOut (GmOutT m) Source 
GmOut m => GmOut (JournalT w m) Source 
GmOut m => GmOut (StateT s m) Source 

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

Re-exporting convenient stuff

class MonadIOC m => MonadIO m where Source

Methods

liftIO :: IO a -> m a Source

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