haskell-tools-daemon-1.0.1.1: Background process for Haskell-tools that editors can connect to.

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Tools.Daemon.Session

Description

Common operations for managing Daemon-tools sessions, for example loading whole packages or re-loading modules when they are changed. Maintains the state of the compilation with loaded modules. Contains checks for compiling the modules to code when Template Haskell is used.

Synopsis

Documentation

loadPackagesFrom :: (ModSummary -> IO ()) -> ([ModSummary] -> IO ()) -> (DaemonSessionState -> FilePath -> IO [FilePath]) -> [FilePath] -> DaemonSession [SourceError] Source #

Load packages from the given directories. Loads modules, performs the given callback action, warns for duplicate modules.

loadVisiblePackages :: DaemonSession () Source #

Loads the packages that are declared visible (by .cabal file).

getFileMods :: String -> DaemonSession (Maybe (SourceFileKey, UnnamedModule), [(SourceFileKey, UnnamedModule)]) Source #

Get the module that is selected for refactoring and all the other modules.

reloadChangedModules :: (ModSummary -> IO a) -> ([ModSummary] -> IO ()) -> (ModSummary -> Bool) -> DaemonSession [a] Source #

Reload the modules that have been changed (given by predicate). Pefrom the callback.

clearModules :: [ModSummary] -> DaemonSession () Source #

Clears the given modules from the GHC state to enable re-loading them From the Haskell-tools state we only clear them individually, when their module collection is determined.

getReachableModules :: ([ModSummary] -> IO ()) -> (ModSummary -> Bool) -> DaemonSession [ModSummary] Source #

Get all modules that can be accessed from a given set of modules. Can be used to select which modules need to be reloaded after a change.

reloadModule :: (ModSummary -> IO a) -> ModSummary -> DaemonSession a Source #

Reload a given module. Perform a callback.

decideMC :: ModSummary -> [ModuleCollection SourceFileKey] -> ModuleCollection SourceFileKey Source #

Select which module collection we think the module is in

withFlagsForModule :: ModuleCollection SourceFileKey -> DaemonSession a -> DaemonSession a Source #

Prepares the DynFlags for the compilation of a module

withLoadFlagsForModules :: [ModuleCollection SourceFileKey] -> DaemonSession a -> DaemonSession a Source #

Prepares the DynFlags for travesing the module graph

checkEvaluatedMods :: [ModSummary] -> DaemonSession () Source #

Finds out if a newly added module forces us to generate code for another one. If the other is already loaded it will be reloaded.

codeGenForModule :: [ModuleCollection SourceFileKey] -> CodeGenPolicy -> ModSummary -> DaemonSession () 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] -> (ModSummary -> IO DynFlags) -> Ghc ([ModSummary], [ModSummary]) Source #

Check which modules can be reached from the module, if it uses template haskell. A definition that needs code generation can be inside a module that does not uses the TemplateHaskell extension.