haskell-tools-refactor-1.1.1.0: Refactoring Tool for Haskell

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Tools.Refactor.Prepare

Description

Defines utility methods that prepare Haskell modules for refactoring

Synopsis

Documentation

type ModuleName = String Source #

Type synonym for module names.

tryRefactor :: (RealSrcSpan -> Refactoring) -> String -> ModuleName -> IO () Source #

A quick function to try the refactorings

correctRefactorSpan :: UnnamedModule -> RealSrcSpan -> RealSrcSpan Source #

Adjust the source range to be applied to the refactored module

useFlags :: [String] -> Ghc ([String], DynFlags -> DynFlags) Source #

Set the given flags for the GHC session. Also gives back a change function that you can use to apply the settings to any flags. Prints out errors and warnings

reloadPkgDb :: Ghc () Source #

Reloads the package database based on the session flags

initGhcFlags :: Ghc () Source #

Initialize GHC flags to default values that support refactoring

initGhcFlags' :: Bool -> Bool -> Ghc () Source #

Sets up basic flags and settings for GHC

useDirs :: [FilePath] -> Ghc () Source #

Use the given source directories when searching for imported modules

deregisterDirs :: [FilePath] -> Ghc () Source #

Don't use the given source directories when searching for imported modules

toFileName :: FilePath -> ModuleName -> FilePath Source #

Translates module name and working directory into the name of the file where the given module should be defined

toBootFileName :: FilePath -> ModuleName -> FilePath Source #

Translates module name and working directory into the name of the file where the boot module should be defined

getSourceDir :: ModSummary -> IO FilePath Source #

Get the source directory where the module is located.

getModSumOrig :: ModSummary -> FilePath Source #

Gets the path to the source file of the module.

getModSumName :: ModSummary -> String Source #

Gets the module name

loadModuleAST :: FilePath -> ModuleName -> Ghc TypedModule Source #

Load the AST of a module given by the working directory and module name.

loadModule :: FilePath -> ModuleName -> Ghc ModSummary Source #

Load the summary of a module given by the working directory and module name.

type TypedModule = Ann UModule IdDom SrcTemplateStage Source #

The final version of our AST, with type infromation added

parseTyped :: ModSummary -> Ghc TypedModule Source #

Get the typed representation of a Haskell module.

withAlteredDynFlags :: GhcMonad m => (DynFlags -> m DynFlags) -> m a -> m a Source #

Modifies the dynamic flags for performing a ghc task

forceCodeGen :: ModSummary -> ModSummary Source #

Forces the code generation for a given module

forceAsmGen :: ModSummary -> ModSummary Source #

Forces ASM code generation for a given module

modSumNormalizeFlags :: ModSummary -> ModSummary Source #

Normalizes the flags for a module summary

normalizeFlags :: DynFlags -> DynFlags Source #

Removes all flags that are unintelligable for refactoring

readSrcSpan :: String -> RealSrcSpan Source #

Read a source range from our textual format: line:col-line:col or line:col

readSrcLoc :: String -> RealSrcLoc Source #

Read a source location from our format: line:col