Safe Haskell | None |
---|---|
Language | Haskell2010 |
Common operations for managing refactoring sessions, for example loading packages, re-loading modules.
- data RefactorSessionState = RefactorSessionState {}
- _refSessMCs :: Lens RefactorSessionState RefactorSessionState [ModuleCollection] [ModuleCollection]
- class IsRefactSessionState st where
- loadPackagesFrom :: IsRefactSessionState st => (ModSummary -> IO a) -> ([ModSummary] -> IO ()) -> (st -> FilePath -> IO [FilePath]) -> [FilePath] -> StateT st Ghc (Either RefactorException ([a], [String]))
- handleErrors :: ExceptionMonad m => m a -> m (Either RefactorException a)
- keyFromMS :: ModSummary -> SourceFileKey
- getMods :: (Monad m, IsRefactSessionState st) => Maybe SourceFileKey -> StateT st m (Maybe (SourceFileKey, UnnamedModule IdDom), [(SourceFileKey, UnnamedModule IdDom)])
- getFileMods :: (GhcMonad m, IsRefactSessionState st) => FilePath -> StateT st m (Maybe (SourceFileKey, UnnamedModule IdDom), [(SourceFileKey, UnnamedModule IdDom)])
- reloadChangedModules :: IsRefactSessionState st => (ModSummary -> IO a) -> ([ModSummary] -> IO ()) -> (ModSummary -> Bool) -> StateT st Ghc (Either RefactorException [a])
- getReachableModules :: IsRefactSessionState st => ([ModSummary] -> IO ()) -> (ModSummary -> Bool) -> StateT st Ghc [ModSummary]
- reloadModule :: IsRefactSessionState st => (ModSummary -> IO a) -> ModSummary -> StateT st Ghc a
- checkEvaluatedMods :: IsRefactSessionState st => (ModSummary -> IO a) -> [ModSummary] -> StateT st Ghc [a]
- codeGenForModule :: (ModSummary -> IO a) -> [ModuleCollection] -> ModSummary -> Ghc a
- getEvaluatedMods :: [ModSummary] -> Ghc [ModSummary]
- modSumName :: ModSummary -> String
- type NodeKey = (ModuleName, IsBoot)
- type NodeMap a = Map NodeKey a
- type SummaryNode = (ModSummary, Int, [Int])
- getModFromNode :: SummaryNode -> ModSummary
- moduleGraphNodes :: Bool -> [ModSummary] -> (Graph SummaryNode, HscSource -> ModuleName -> Maybe SummaryNode)
- hscSourceToIsBoot :: HscSource -> IsBoot
- summaryNodeKey :: SummaryNode -> Int
- ms_home_imps :: ModSummary -> [Located ModuleName]
- ms_home_srcimps :: ModSummary -> [Located ModuleName]
- home_imps :: [(Maybe FastString, Located ModuleName)] -> [Located ModuleName]
Documentation
data RefactorSessionState Source #
The state common for refactoring tools, carrying the state of modules.
_refSessMCs :: Lens RefactorSessionState RefactorSessionState [ModuleCollection] [ModuleCollection] Source #
class IsRefactSessionState st where Source #
A common class for the state of refactoring tools
refSessMCs :: Simple Lens st [ModuleCollection] Source #
initSession :: st Source #
loadPackagesFrom :: IsRefactSessionState st => (ModSummary -> IO a) -> ([ModSummary] -> IO ()) -> (st -> FilePath -> IO [FilePath]) -> [FilePath] -> StateT st Ghc (Either RefactorException ([a], [String])) Source #
Load packages from the given directories. Loads modules, performs the given callback action, warns for duplicate modules.
handleErrors :: ExceptionMonad m => m a -> m (Either RefactorException a) Source #
Handle GHC exceptions and RefactorException.
keyFromMS :: ModSummary -> SourceFileKey Source #
getMods :: (Monad m, IsRefactSessionState st) => Maybe SourceFileKey -> StateT st m (Maybe (SourceFileKey, UnnamedModule IdDom), [(SourceFileKey, UnnamedModule IdDom)]) Source #
getFileMods :: (GhcMonad m, IsRefactSessionState st) => FilePath -> StateT st m (Maybe (SourceFileKey, UnnamedModule IdDom), [(SourceFileKey, UnnamedModule IdDom)]) Source #
reloadChangedModules :: IsRefactSessionState st => (ModSummary -> IO a) -> ([ModSummary] -> IO ()) -> (ModSummary -> Bool) -> StateT st Ghc (Either RefactorException [a]) Source #
Reload the modules that have been changed (given by predicate). Pefrom the callback.
getReachableModules :: IsRefactSessionState st => ([ModSummary] -> IO ()) -> (ModSummary -> Bool) -> StateT st Ghc [ModSummary] Source #
reloadModule :: IsRefactSessionState st => (ModSummary -> IO a) -> ModSummary -> StateT st Ghc a Source #
Reload a given module. Perform a callback.
checkEvaluatedMods :: IsRefactSessionState st => (ModSummary -> IO a) -> [ModSummary] -> StateT st Ghc [a] Source #
codeGenForModule :: (ModSummary -> IO a) -> [ModuleCollection] -> ModSummary -> Ghc a Source #
Re-load the module with code generation enabled. Must be used when the module had already been loaded, but code generation were not enabled by then.
getEvaluatedMods :: [ModSummary] -> Ghc [ModSummary] Source #
Check which modules can be reached from the module, if it uses template haskell.
modSumName :: ModSummary -> String Source #
code copied from GHC because it is not public in GhcMake module
type NodeKey = (ModuleName, IsBoot) Source #
type SummaryNode = (ModSummary, Int, [Int]) Source #
moduleGraphNodes :: Bool -> [ModSummary] -> (Graph SummaryNode, HscSource -> ModuleName -> Maybe SummaryNode) Source #
hscSourceToIsBoot :: HscSource -> IsBoot Source #
summaryNodeKey :: SummaryNode -> Int Source #
ms_home_imps :: ModSummary -> [Located ModuleName] Source #
ms_home_srcimps :: ModSummary -> [Located ModuleName] Source #
home_imps :: [(Maybe FastString, Located ModuleName)] -> [Located ModuleName] Source #