ghc-mod-5.7.0.0: Happy Haskell Programming

Safe Haskell | None
Language | Haskell2010

Language.Haskell.GhcMod.Monad.Types

Contents

- Monad Types
- Environment, state and logging
- Accessing `GhcModEnv`, `GhcModState` and `GhcModLog`
- Re-exporting convenient stuff
- Orphan instances

Synopsis

- type GhcModT m = GmT (GmOutT m)
- newtype GmOutT m a = GmOutT {
  - unGmOutT :: ReaderT GhcModOut m a
  }
- newtype GmT m a = GmT {
  - unGmT :: StateT GhcModState (ErrorT GhcModError (JournalT GhcModLog (ReaderT GhcModEnv m))) a
  }
- newtype GmlT m a = GmlT {
  - unGmlT :: GhcModT m a
  }
- newtype LightGhc a = LightGhc {
  - unLightGhc :: ReaderT (IORef HscEnv) IO a
  }
- type GmGhc m = (IOish m, GhcMonad m)
- type IOish m = (Functor m, MonadIO m, MonadBaseControl IO m, ExceptionMonad m)
- data GhcModEnv = GhcModEnv {
  - gmOptions :: Options
  - gmCradle :: Cradle
  }
- data GhcModState = GhcModState {
  - gmGhcSession :: !(Maybe GmGhcSession)
  - gmCaches :: !GhcModCaches
  - gmMMappedFiles :: !FileMappingMap
  }
- data GhcModCaches = GhcModCaches {
  - gmcPackageDbStack :: CacheContents ChCacheData [GhcPkgDb]
  - gmcMergedPkgOptions :: CacheContents ChCacheData [GHCOption]
  - gmcComponents :: CacheContents ChCacheData [GmComponent GMCRaw ChEntrypoint]
  - gmcResolvedComponents :: CacheContents [GmComponent GMCRaw (Set ModulePath)] (Map ChComponentName (GmComponent GMCResolved (Set ModulePath)))
  }
- defaultGhcModState :: GhcModState
- data GmGhcSession = GmGhcSession {
  - gmgsOptions :: ![GHCOption]
  - gmgsSession :: !(IORef HscEnv)
  }
- data GmComponent t eps = GmComponent {
  - gmcHomeModuleGraph :: GmModuleGraph
  - gmcName :: ChComponentName
  - gmcGhcOpts :: [GHCOption]
  - gmcGhcPkgOpts :: [GHCOption]
  - gmcGhcSrcOpts :: [GHCOption]
  - gmcGhcLangOpts :: [GHCOption]
  - gmcRawEntrypoints :: ChEntrypoint
  - gmcEntrypoints :: eps
  - gmcSourceDirs :: [FilePath]
  }
- data GmLogLevel
  - = GmSilent
  - | GmPanic
  - | GmException
  - | GmError
  - | GmWarning
  - | GmInfo
  - | GmDebug
  - | GmVomit
- data GhcModLog = GhcModLog {
  - gmLogLevel :: Maybe GmLogLevel
  - gmLogVomitDump :: Last Bool
  - gmLogMessages :: [(GmLogLevel, String, Doc)]
  }
- data GhcModError
  - = GMENoMsg
  - | GMEString String
  - | GMECabalConfigure GhcModError
  - | GMEStackConfigure GhcModError
  - | GMEStackBootstrap GhcModError
  - | GMECabalCompAssignment [(Either FilePath ModuleName, Set ChComponentName)]
  - | GMEProcess String String [String] (Either Int GhcModError)
  - | GMENoCabalFile
  - | GMETooManyCabalFiles [FilePath]
- type Gm m = (GmEnv m, GmState m, GmLog m, GmOut m)
- class Monad m => GmEnv m where
- class Monad m => GmState m where
- class Monad m => GmLog m where
- class Monad m => GmOut m where
- cradle :: GmEnv m => m Cradle
- options :: GmEnv m => m Options
- outputOpts :: GmOut m => m OutputOpts
- withOptions :: GmEnv m => (Options -> Options) -> m a -> m a
- getMMappedFiles :: GmState m => m FileMappingMap
- setMMappedFiles :: GmState m => FileMappingMap -> m ()
- addMMappedFile :: GmState m => FilePath -> FileMapping -> m ()
- delMMappedFile :: GmState m => FilePath -> m ()
- lookupMMappedFile :: GmState m => FilePath -> m (Maybe FileMapping)
- getMMappedFilePaths :: GmState m => m [FilePath]
- class MonadIOC m => MonadIO m where
- liftIO :: MonadIO m => IO a -> m a
- gmlGetSession :: (MonadIO m, MonadBaseControl IO m) => GmlT m HscEnv
- gmlSetSession :: (MonadIO m, MonadBaseControl IO m) => HscEnv -> GmlT m ()

# Monad Types

type GhcModT m = GmT (GmOutT m) #

newtype GmOutT m a #

Constructors

GmOutT |
Fields unGmOutT :: ReaderT GhcModOut m a

Instances

MonadTrans GmOutT # |
Methods lift :: Monad m => m a -> GmOutT m a #
MonadTransControl GmOutT # |
Associated Types type StT (GmOutT :: (* -> *) -> * -> *) a :: * # Methods liftWith :: Monad m => (Run GmOutT -> m a) -> GmOutT m a # restoreT :: Monad m => m (StT GmOutT a) -> GmOutT m a #
MonadBaseControl IO m => MonadBase IO (GmOutT m) # |
Methods liftBase :: IO α -> GmOutT m α #
MonadBaseControl IO m => MonadBaseControl IO (GmOutT m) # |
Associated Types type StM (GmOutT m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (GmOutT m) IO -> IO a) -> GmOutT m a # restoreM :: StM (GmOutT m) a -> GmOutT m a #
Monad m => Monad (GmOutT m) # |
Methods (>>=) :: GmOutT m a -> (a -> GmOutT m b) -> GmOutT m b # (>>) :: GmOutT m a -> GmOutT m b -> GmOutT m b # return :: a -> GmOutT m a # fail :: String -> GmOutT m a #
Functor m => Functor (GmOutT m) # |
Methods fmap :: (a -> b) -> GmOutT m a -> GmOutT m b # (<$) :: a -> GmOutT m b -> GmOutT m a #
Applicative m => Applicative (GmOutT m) # |
Methods pure :: a -> GmOutT m a # (<*>) :: GmOutT m (a -> b) -> GmOutT m a -> GmOutT m b # (*>) :: GmOutT m a -> GmOutT m b -> GmOutT m b # (<*) :: GmOutT m a -> GmOutT m b -> GmOutT m a #
MonadPlus m => MonadPlus (GmOutT m) # |
Methods mzero :: GmOutT m a # mplus :: GmOutT m a -> GmOutT m a -> GmOutT m a #
Alternative m => Alternative (GmOutT m) # |
Methods empty :: GmOutT m a # (<|>) :: GmOutT m a -> GmOutT m a -> GmOutT m a # some :: GmOutT m a -> GmOutT m [a] # many :: GmOutT m a -> GmOutT 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 #
GmLog m => GmLog (GmOutT m) # |
Methods gmlJournal :: GhcModLog -> GmOutT m () # gmlHistory :: GmOutT m GhcModLog # gmlClear :: GmOutT m () #
Monad m => GmOut (GmOutT m) # |
Methods gmoAsk :: GmOutT m GhcModOut #
type StT GmOutT a # |
type StT GmOutT a = StT (ReaderT * GhcModEnv) a
type StM (GmOutT m) a # |
type StM (GmOutT m) a = StM (ReaderT * GhcModEnv m) a

newtype GmT m a #

Constructors

GmT |
Fields unGmT :: StateT GhcModState (ErrorT GhcModError (JournalT GhcModLog (ReaderT GhcModEnv m))) a

Instances

MonadTrans GmT # |
Methods lift :: Monad m => m a -> GmT m a #
MonadTransControl GmT # |
Associated Types type StT (GmT :: (* -> *) -> * -> *) a :: * # Methods liftWith :: Monad m => (Run GmT -> m a) -> GmT m a # restoreT :: Monad m => m (StT GmT a) -> GmT m a #
MonadBaseControl IO m => MonadBase IO (GmT m) # |
Methods liftBase :: IO α -> GmT m α #
MonadBaseControl IO m => MonadBaseControl IO (GmT m) # |
Associated Types type StM (GmT m :: * -> *) a :: * # Methods liftBaseWith :: (RunInBase (GmT m) IO -> IO a) -> GmT m a # restoreM :: StM (GmT m) a -> GmT m a #
Monad m => MonadJournal GhcModLog (GmT m) # |
Methods journal :: GhcModLog -> GmT m () # history :: GmT m GhcModLog # clear :: GmT m () #
Monad m => MonadError GhcModError (GmT m) # |
Methods throwError :: GhcModError -> GmT m a # catchError :: GmT m a -> (GhcModError -> GmT m a) -> GmT m a #
MonadReader r m => MonadReader r (GmT m) # |
Methods ask :: GmT m r # local :: (r -> r) -> GmT m a -> GmT m a # reader :: (r -> a) -> GmT m a #
MonadState s m => MonadState s (GmT m) # |
Methods get :: GmT m s # put :: s -> GmT m () # state :: (s -> (a, s)) -> GmT m a #
Monad m => Monad (GmT m) # |
Methods (>>=) :: GmT m a -> (a -> GmT m b) -> GmT m b # (>>) :: GmT m a -> GmT m b -> GmT m b # return :: a -> GmT m a # fail :: String -> GmT m a #
Functor m => Functor (GmT m) # |
Methods fmap :: (a -> b) -> GmT m a -> GmT m b # (<$) :: a -> GmT m b -> GmT m a #
Monad m => Applicative (GmT m) # |
Methods pure :: a -> GmT m a # (<*>) :: GmT m (a -> b) -> GmT m a -> GmT m b # (*>) :: GmT m a -> GmT m b -> GmT m b # (<*) :: GmT m a -> GmT m b -> GmT m a #
Monad m => MonadPlus (GmT m) # |
Methods mzero :: GmT m a # mplus :: GmT m a -> GmT m a -> GmT m a #
Monad m => Alternative (GmT m) # |
Methods empty :: GmT m a # (<|>) :: GmT m a -> GmT m a -> GmT m a # some :: GmT m a -> GmT m [a] # many :: GmT m a -> GmT 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 #
Monad m => GmLog (GmT m) # |
Methods gmlJournal :: GhcModLog -> GmT m () # gmlHistory :: GmT m GhcModLog # gmlClear :: GmT m () #
GmOut m => GmOut (GmT m) # |
Methods gmoAsk :: GmT m GhcModOut #
Monad m => GmState (GmT m) # |
Methods gmsGet :: GmT m GhcModState # gmsPut :: GhcModState -> GmT m () # gmsState :: (GhcModState -> (a, GhcModState)) -> GmT m a #
type StT GmT a # |
type StT GmT a = (Either GhcModError (a, GhcModState), GhcModLog)
type StM (GmT m) a # |
type StM (GmT m) a = StM (StateT GhcModState (ErrorT GhcModError (JournalT GhcModLog (ReaderT * GhcModEnv m)))) a

newtype GmlT m a #

Constructors

GmlT |
Fields unGmlT :: GhcModT m a

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) # |
Methods gmlJournal :: GhcModLog -> GmlT m () # gmlHistory :: GmlT m GhcModLog # gmlClear :: 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

newtype LightGhc a #

Constructors

LightGhc |
Fields unLightGhc :: ReaderT (IORef HscEnv) IO a

Instances

Monad LightGhc # |
Methods (>>=) :: LightGhc a -> (a -> LightGhc b) -> LightGhc b # (>>) :: LightGhc a -> LightGhc b -> LightGhc b # return :: a -> LightGhc a # fail :: String -> LightGhc a #
Functor LightGhc # |
Methods fmap :: (a -> b) -> LightGhc a -> LightGhc b # (<$) :: a -> LightGhc b -> LightGhc a #
Applicative LightGhc # |
Methods pure :: a -> LightGhc a # (<*>) :: LightGhc (a -> b) -> LightGhc a -> LightGhc b # (*>) :: LightGhc a -> LightGhc b -> LightGhc b # (<*) :: LightGhc a -> LightGhc b -> LightGhc a #

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

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

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 #

Constructors

GhcModEnv |
Fields gmOptions :: Options gmCradle :: Cradle

data GhcModState #

Constructors

GhcModState |
Fields gmGhcSession :: !(Maybe GmGhcSession) gmCaches :: !GhcModCaches gmMMappedFiles :: !FileMappingMap

Instances

Monad m => GmState (StateT GhcModState m) # |
Methods gmsGet :: StateT GhcModState m GhcModState # gmsPut :: GhcModState -> StateT GhcModState m () # gmsState :: (GhcModState -> (a, GhcModState)) -> StateT GhcModState m a #

data GhcModCaches #

Constructors

GhcModCaches |
Fields gmcPackageDbStack :: CacheContents ChCacheData [GhcPkgDb] gmcMergedPkgOptions :: CacheContents ChCacheData [GHCOption] gmcComponents :: CacheContents ChCacheData [GmComponent GMCRaw ChEntrypoint] gmcResolvedComponents :: CacheContents [GmComponent GMCRaw (Set ModulePath)] (Map ChComponentName (GmComponent GMCResolved (Set ModulePath)))

defaultGhcModState :: GhcModState #

data GmGhcSession #

Constructors

GmGhcSession |
Fields gmgsOptions :: ![GHCOption] gmgsSession :: !(IORef HscEnv)

data GmComponent t eps #

Constructors

GmComponent |
Fields gmcHomeModuleGraph :: GmModuleGraph gmcName :: ChComponentName gmcGhcOpts :: [GHCOption] gmcGhcPkgOpts :: [GHCOption] gmcGhcSrcOpts :: [GHCOption] gmcGhcLangOpts :: [GHCOption] gmcRawEntrypoints :: ChEntrypoint gmcEntrypoints :: eps gmcSourceDirs :: [FilePath]

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) # |
Methods readsPrec :: Int -> ReadS (GmComponent t eps) # readList :: ReadS [GmComponent t eps] # readPrec :: ReadPrec (GmComponent t eps) # readListPrec :: ReadPrec [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) # |
type Rep (GmComponent t eps) = D1 (MetaData "GmComponent" "Language.Haskell.GhcMod.Types" "ghc-mod-5.7.0.0-KxGeefmr8DvC60AFyUafBd" False) (C1 (MetaCons "GmComponent" PrefixI True) ((:*:) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "gmcHomeModuleGraph") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 GmModuleGraph)) (S1 (MetaSel (Just Symbol "gmcName") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ChComponentName))) ((:*:) (S1 (MetaSel (Just Symbol "gmcGhcOpts") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [GHCOption])) (S1 (MetaSel (Just Symbol "gmcGhcPkgOpts") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [GHCOption])))) ((:*:) ((:*:) (S1 (MetaSel (Just Symbol "gmcGhcSrcOpts") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [GHCOption])) (S1 (MetaSel (Just Symbol "gmcGhcLangOpts") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [GHCOption]))) ((:*:) (S1 (MetaSel (Just Symbol "gmcRawEntrypoints") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ChEntrypoint)) ((:*:) (S1 (MetaSel (Just Symbol "gmcEntrypoints") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 eps)) (S1 (MetaSel (Just Symbol "gmcSourceDirs") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 [FilePath])))))))

# Accessing `GhcModEnv`, `GhcModState` and `GhcModLog`

data GmLogLevel #

Constructors

GmSilent |
GmPanic |
GmException |
GmError |
GmWarning |
GmInfo |
GmDebug |
GmVomit |

Instances

Bounded GmLogLevel # |
Methods minBound :: GmLogLevel # maxBound :: GmLogLevel #
Enum GmLogLevel # |
Methods succ :: GmLogLevel -> GmLogLevel # pred :: GmLogLevel -> GmLogLevel # toEnum :: Int -> GmLogLevel # fromEnum :: GmLogLevel -> Int # enumFrom :: GmLogLevel -> [GmLogLevel] # enumFromThen :: GmLogLevel -> GmLogLevel -> [GmLogLevel] # enumFromTo :: GmLogLevel -> GmLogLevel -> [GmLogLevel] # enumFromThenTo :: GmLogLevel -> GmLogLevel -> GmLogLevel -> [GmLogLevel] #
Eq GmLogLevel # |
Methods (==) :: GmLogLevel -> GmLogLevel -> Bool # (/=) :: GmLogLevel -> GmLogLevel -> Bool #
Ord GmLogLevel # |
Methods compare :: GmLogLevel -> GmLogLevel -> Ordering # (<) :: GmLogLevel -> GmLogLevel -> Bool # (<=) :: GmLogLevel -> GmLogLevel -> Bool # (>) :: GmLogLevel -> GmLogLevel -> Bool # (>=) :: GmLogLevel -> GmLogLevel -> Bool # max :: GmLogLevel -> GmLogLevel -> GmLogLevel # min :: GmLogLevel -> GmLogLevel -> GmLogLevel #
Read GmLogLevel # |
Methods readsPrec :: Int -> ReadS GmLogLevel # readList :: ReadS [GmLogLevel] # readPrec :: ReadPrec GmLogLevel # readListPrec :: ReadPrec [GmLogLevel] #
Show GmLogLevel # |
Methods showsPrec :: Int -> GmLogLevel -> ShowS # show :: GmLogLevel -> String # showList :: [GmLogLevel] -> ShowS #

data GhcModLog #

Constructors

GhcModLog |
Fields gmLogLevel :: Maybe GmLogLevel gmLogVomitDump :: Last Bool gmLogMessages :: [(GmLogLevel, String, Doc)]

Instances

Show GhcModLog # |
Methods showsPrec :: Int -> GhcModLog -> ShowS # show :: GhcModLog -> String # showList :: [GhcModLog] -> ShowS #
Monoid GhcModLog # |
Methods mempty :: GhcModLog # mappend :: GhcModLog -> GhcModLog -> GhcModLog # mconcat :: [GhcModLog] -> GhcModLog #
Monad m => MonadJournal GhcModLog (GmT m) # |
Methods journal :: GhcModLog -> GmT m () # history :: GmT m GhcModLog # clear :: GmT m () #
GmEnv m => GmEnv (JournalT GhcModLog m) # |
Methods gmeAsk :: JournalT GhcModLog m GhcModEnv # gmeReader :: (GhcModEnv -> a) -> JournalT GhcModLog m a # gmeLocal :: (GhcModEnv -> GhcModEnv) -> JournalT GhcModLog m a -> JournalT GhcModLog m a #
Monad m => GmLog (JournalT GhcModLog m) # |
Methods gmlJournal :: GhcModLog -> JournalT GhcModLog m () # gmlHistory :: JournalT GhcModLog m GhcModLog # gmlClear :: JournalT GhcModLog m () #

data GhcModError #

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.

Instances

Eq GhcModError # |
Methods (==) :: GhcModError -> GhcModError -> Bool # (/=) :: GhcModError -> GhcModError -> Bool #
Show GhcModError # |
Methods showsPrec :: Int -> GhcModError -> ShowS # show :: GhcModError -> String # showList :: [GhcModError] -> ShowS #
Exception GhcModError # |
Methods toException :: GhcModError -> SomeException # fromException :: SomeException -> Maybe GhcModError # displayException :: GhcModError -> String #
Error GhcModError # |
Methods noMsg :: GhcModError # strMsg :: String -> GhcModError #
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 => MonadError GhcModError (GmT m) # |
Methods throwError :: GhcModError -> GmT m a # catchError :: GmT m a -> (GhcModError -> GmT m a) -> GmT m a #
GmEnv m => GmEnv (ErrorT GhcModError m) # |
Methods gmeAsk :: ErrorT GhcModError m GhcModEnv # gmeReader :: (GhcModEnv -> a) -> ErrorT GhcModError m a # gmeLocal :: (GhcModEnv -> GhcModEnv) -> ErrorT GhcModError m a -> ErrorT GhcModError m a #

type Gm m = (GmEnv m, GmState m, GmLog m, GmOut m) #

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) # |
Methods gmeAsk :: JournalT GhcModLog m GhcModEnv # gmeReader :: (GhcModEnv -> a) -> JournalT GhcModLog m a # gmeLocal :: (GhcModEnv -> GhcModEnv) -> JournalT GhcModLog m a -> JournalT GhcModLog m a #
GmEnv m => GmEnv (ErrorT GhcModError m) # |
Methods gmeAsk :: ErrorT GhcModError m GhcModEnv # gmeReader :: (GhcModEnv -> a) -> ErrorT GhcModError m a # gmeLocal :: (GhcModEnv -> GhcModEnv) -> ErrorT GhcModError m a -> ErrorT GhcModError m a #
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 #

class Monad m => GmState m where #

Minimal complete definition

gmsState | gmsGet, gmsPut

Methods

gmsGet :: m GhcModState #

gmsPut :: GhcModState -> m () #

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

Instances

GmState m => GmState (MaybeT m) # |
Methods gmsGet :: MaybeT m GhcModState # gmsPut :: GhcModState -> MaybeT m () # gmsState :: (GhcModState -> (a, GhcModState)) -> MaybeT m a #
(Monad m, GmState (GhcModT m)) => GmState (GmlT m) # |
Methods gmsGet :: GmlT m GhcModState # gmsPut :: GhcModState -> GmlT m () # gmsState :: (GhcModState -> (a, GhcModState)) -> GmlT m a #
Monad m => GmState (GmT m) # |
Methods gmsGet :: GmT m GhcModState # gmsPut :: GhcModState -> GmT m () # gmsState :: (GhcModState -> (a, GhcModState)) -> GmT m a #
GmState m => GmState (StateT s m) # |
Methods gmsGet :: StateT s m GhcModState # gmsPut :: GhcModState -> StateT s m () # gmsState :: (GhcModState -> (a, GhcModState)) -> StateT s m a #
Monad m => GmState (StateT GhcModState m) # |
Methods gmsGet :: StateT GhcModState m GhcModState # gmsPut :: GhcModState -> StateT GhcModState m () # gmsState :: (GhcModState -> (a, GhcModState)) -> StateT GhcModState m a #

class Monad m => GmLog m where #

Minimal complete definition

gmlJournal, gmlHistory, gmlClear

Methods

gmlJournal :: GhcModLog -> m () #

gmlHistory :: m GhcModLog #

gmlClear :: m () #

Instances

(Monad m, GmLog m) => GmLog (MaybeT m) # |
Methods gmlJournal :: GhcModLog -> MaybeT m () # gmlHistory :: MaybeT m GhcModLog # gmlClear :: MaybeT m () #
(Monad m, GmLog (GhcModT m)) => GmLog (GmlT m) # |
Methods gmlJournal :: GhcModLog -> GmlT m () # gmlHistory :: GmlT m GhcModLog # gmlClear :: GmlT m () #
Monad m => GmLog (GmT m) # |
Methods gmlJournal :: GhcModLog -> GmT m () # gmlHistory :: GmT m GhcModLog # gmlClear :: GmT m () #
GmLog m => GmLog (GmOutT m) # |
Methods gmlJournal :: GhcModLog -> GmOutT m () # gmlHistory :: GmOutT m GhcModLog # gmlClear :: GmOutT m () #
Monad m => GmLog (LogDiscardT m) # |
Methods gmlJournal :: GhcModLog -> LogDiscardT m () # gmlHistory :: LogDiscardT m GhcModLog # gmlClear :: LogDiscardT m () #
Monad m => GmLog (JournalT GhcModLog m) # |
Methods gmlJournal :: GhcModLog -> JournalT GhcModLog m () # gmlHistory :: JournalT GhcModLog m GhcModLog # gmlClear :: JournalT GhcModLog m () #
(Monad m, GmLog m, Error e) => GmLog (ErrorT e m) # |
Methods gmlJournal :: GhcModLog -> ErrorT e m () # gmlHistory :: ErrorT e m GhcModLog # gmlClear :: ErrorT e m () #
(Monad m, GmLog m) => GmLog (StateT s m) # |
Methods gmlJournal :: GhcModLog -> StateT s m () # gmlHistory :: StateT s m GhcModLog # gmlClear :: StateT s m () #
(Monad m, GmLog m) => GmLog (ReaderT * r m) # |
Methods gmlJournal :: GhcModLog -> ReaderT * r m () # gmlHistory :: ReaderT * r m GhcModLog # gmlClear :: ReaderT * r m () #

class Monad m => GmOut m where #

Minimal complete definition

gmoAsk

Methods

gmoAsk :: m GhcModOut #

Instances

GmOut m => GmOut (MaybeT m) # |
Methods gmoAsk :: MaybeT m GhcModOut #
Monad m => GmOut (GmlT m) # |
Methods gmoAsk :: GmlT m GhcModOut #
GmOut m => GmOut (GmT m) # |
Methods gmoAsk :: GmT m GhcModOut #
Monad m => GmOut (GmOutT m) # |
Methods gmoAsk :: GmOutT m GhcModOut #
GmOut m => GmOut (JournalT w m) # |
Methods gmoAsk :: JournalT w m GhcModOut #
GmOut m => GmOut (StateT s m) # |
Methods gmoAsk :: StateT s m GhcModOut #

cradle :: GmEnv m => m Cradle #

options :: GmEnv m => m Options #

outputOpts :: GmOut m => m OutputOpts #

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

getMMappedFiles :: GmState m => m FileMappingMap #

setMMappedFiles :: GmState m => FileMappingMap -> m () #

addMMappedFile :: GmState m => FilePath -> FileMapping -> m () #

delMMappedFile :: GmState m => FilePath -> m () #

lookupMMappedFile :: GmState m => FilePath -> m (Maybe FileMapping) #

getMMappedFilePaths :: GmState m => m [FilePath] #

# Re-exporting convenient stuff

class MonadIOC m => MonadIO m where #

Minimal complete definition

liftIO

Methods

liftIO :: IO a -> m a #

liftIO :: MonadIO m => IO a -> m a #

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

# Orphan instances

GhcMonad LightGhc # |
Methods getSession :: LightGhc HscEnv # setSession :: HscEnv -> LightGhc () #
HasDynFlags LightGhc # |
Methods getDynFlags :: LightGhc DynFlags #
ExceptionMonad LightGhc # |
Methods gcatch :: Exception e => LightGhc a -> (e -> LightGhc a) -> LightGhc a # gmask :: ((LightGhc a -> LightGhc a) -> LightGhc b) -> LightGhc b # gbracket :: LightGhc a -> (a -> LightGhc b) -> (a -> LightGhc c) -> LightGhc c # gfinally :: LightGhc a -> LightGhc b -> LightGhc a #
(MonadIO m, MonadBaseControl IO m) => GhcMonad (GmlT m) # |
Methods getSession :: GmlT m HscEnv # setSession :: HscEnv -> GmlT m () #
(MonadIO m, MonadBaseControl IO m) => HasDynFlags (GmlT m) # |
Methods getDynFlags :: GmlT m DynFlags #
(MonadIO m, MonadBaseControl IO m) => ExceptionMonad (MaybeT m) # |
Methods gcatch :: Exception e => MaybeT m a -> (e -> MaybeT m a) -> MaybeT m a # gmask :: ((MaybeT m a -> MaybeT m a) -> MaybeT m b) -> MaybeT m b # gbracket :: MaybeT m a -> (a -> MaybeT m b) -> (a -> MaybeT m c) -> MaybeT m c # gfinally :: MaybeT m a -> MaybeT m b -> MaybeT m a #
(MonadIO m, MonadBaseControl IO m) => ExceptionMonad (GmlT m) # |
Methods gcatch :: Exception e => GmlT m a -> (e -> GmlT m a) -> GmlT m a # gmask :: ((GmlT m a -> GmlT m a) -> GmlT m b) -> GmlT m b # gbracket :: GmlT m a -> (a -> GmlT m b) -> (a -> GmlT m c) -> GmlT m c # gfinally :: GmlT m a -> GmlT m b -> GmlT m a #
(MonadIO m, MonadBaseControl IO m) => ExceptionMonad (GmT m) # |
Methods gcatch :: Exception e => GmT m a -> (e -> GmT m a) -> GmT m a # gmask :: ((GmT m a -> GmT m a) -> GmT m b) -> GmT m b # gbracket :: GmT m a -> (a -> GmT m b) -> (a -> GmT m c) -> GmT m c # gfinally :: GmT m a -> GmT m b -> GmT m a #
(MonadIO m, MonadBaseControl IO m) => ExceptionMonad (GmOutT m) # |
Methods gcatch :: Exception e => GmOutT m a -> (e -> GmOutT m a) -> GmOutT m a # gmask :: ((GmOutT m a -> GmOutT m a) -> GmOutT m b) -> GmOutT m b # gbracket :: GmOutT m a -> (a -> GmOutT m b) -> (a -> GmOutT m c) -> GmOutT m c # gfinally :: GmOutT m a -> GmOutT m b -> GmOutT m a #
(Monoid w, MonadIO m, MonadBaseControl IO m) => ExceptionMonad (JournalT w m) # |
Methods gcatch :: Exception e => JournalT w m a -> (e -> JournalT w m a) -> JournalT w m a # gmask :: ((JournalT w m a -> JournalT w m a) -> JournalT w m b) -> JournalT w m b # gbracket :: JournalT w m a -> (a -> JournalT w m b) -> (a -> JournalT w m c) -> JournalT w m c # gfinally :: JournalT w m a -> JournalT w m b -> JournalT w m a #
(MonadIO m, MonadBaseControl IO m) => ExceptionMonad (StateT s m) # |
Methods gcatch :: Exception e => StateT s m a -> (e -> StateT s m a) -> StateT s m a # gmask :: ((StateT s m a -> StateT s m a) -> StateT s m b) -> StateT s m b # gbracket :: StateT s m a -> (a -> StateT s m b) -> (a -> StateT s m c) -> StateT s m c # gfinally :: StateT s m a -> StateT s m b -> StateT s m a #
(MonadIO m, MonadBaseControl IO m) => ExceptionMonad (ReaderT * s m) # |
Methods gcatch :: Exception e => ReaderT * s m a -> (e -> ReaderT * s m a) -> ReaderT * s m a # gmask :: ((ReaderT * s m a -> ReaderT * s m a) -> ReaderT * s m b) -> ReaderT * s m b # gbracket :: ReaderT * s m a -> (a -> ReaderT * s m b) -> (a -> ReaderT * s m c) -> ReaderT * s m c # gfinally :: ReaderT * s m a -> ReaderT * s m b -> ReaderT * s m a #