Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.Haskell.Tools.Refactor.Session
Description
Common operations for managing refactoring sessions, for example loading packages, re-loading modules.
- data RefactorSessionState = RefactorSessionState {}
- _refSessMCs :: Lens RefactorSessionState RefactorSessionState [ModuleCollection] [ModuleCollection]
- loadPackagesFrom :: IsRefactSessionState st => (ModSummary -> IO a) -> ([ModSummary] -> IO ()) -> (st -> FilePath -> IO [FilePath]) -> [FilePath] -> StateT st Ghc (Either RefactorException [a])
- 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] -> (ModSummary -> DynFlags -> IO DynFlags) -> Ghc [ModSummary]
- modSumName :: ModSummary -> String
- type NodeKey = (ModuleName, HscSource)
- type NodeMap a = Map NodeKey a
- type SummaryNode = (ModSummary, Int, [Int])
- getModFromNode :: SummaryNode -> ModSummary
- moduleGraphNodes :: Bool -> [ModSummary] -> (Graph SummaryNode, HscSource -> ModuleName -> Maybe SummaryNode)
- 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 #
The state common for refactoring tools, carrying the state of modules.
Constructors
RefactorSessionState | |
Fields |
Instances
_refSessMCs :: Lens RefactorSessionState RefactorSessionState [ModuleCollection] [ModuleCollection] #
loadPackagesFrom :: IsRefactSessionState st => (ModSummary -> IO a) -> ([ModSummary] -> IO ()) -> (st -> FilePath -> IO [FilePath]) -> [FilePath] -> StateT st Ghc (Either RefactorException [a]) #
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) #
Handle GHC exceptions and RefactorException.
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]) #
Reload the modules that have been changed (given by predicate). Pefrom the callback.
getReachableModules :: IsRefactSessionState st => ([ModSummary] -> IO ()) -> (ModSummary -> Bool) -> StateT st Ghc [ModSummary] #
reloadModule :: IsRefactSessionState st => (ModSummary -> IO a) -> ModSummary -> StateT st Ghc a #
Reload a given module. Perform a callback.
checkEvaluatedMods :: IsRefactSessionState st => (ModSummary -> IO a) -> [ModSummary] -> StateT st Ghc [a] #
codeGenForModule :: (ModSummary -> IO a) -> [ModuleCollection] -> ModSummary -> Ghc a #
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] -> (ModSummary -> DynFlags -> IO DynFlags) -> Ghc [ModSummary] #
Check which modules can be reached from the module, if it uses template haskell.
modSumName :: ModSummary -> String #
code copied from GHC because it is not public in GhcMake module
type NodeKey = (ModuleName, HscSource) #
type SummaryNode = (ModSummary, Int, [Int]) #
getModFromNode :: SummaryNode -> ModSummary #
moduleGraphNodes :: Bool -> [ModSummary] -> (Graph SummaryNode, HscSource -> ModuleName -> Maybe SummaryNode) #
summaryNodeKey :: SummaryNode -> Int #
ms_home_imps :: ModSummary -> [Located ModuleName] #
ms_home_srcimps :: ModSummary -> [Located ModuleName] #
home_imps :: [(Maybe FastString, Located ModuleName)] -> [Located ModuleName] #