Safe Haskell | None |
---|---|
Language | Haskell2010 |
Language.Haskell.Tools.Refactor.Prepare
Description
Defines utility methods that prepare Haskell modules for refactoring
Synopsis
- type ModuleName = String
- tryRefactor :: (RealSrcSpan -> Refactoring) -> String -> ModuleName -> IO ()
- correctRefactorSpan :: UnnamedModule -> RealSrcSpan -> RealSrcSpan
- useFlags :: [String] -> Ghc ([String], DynFlags -> DynFlags)
- pprWarning :: Warn -> SDoc
- pprErr :: Err -> SDoc
- reloadPkgDb :: Ghc ()
- initGhcFlags :: Ghc ()
- initGhcFlagsForTest :: Ghc ()
- initGhcFlags' :: Bool -> Bool -> Ghc ()
- useDirs :: [FilePath] -> Ghc ()
- deregisterDirs :: [FilePath] -> Ghc ()
- toFileName :: FilePath -> ModuleName -> FilePath
- toBootFileName :: FilePath -> ModuleName -> FilePath
- getSourceDir :: ModSummary -> IO FilePath
- getModSumOrig :: ModSummary -> FilePath
- keyFromMS :: ModSummary -> SourceFileKey
- getModSumName :: ModSummary -> String
- loadModuleAST :: FilePath -> ModuleName -> Ghc TypedModule
- loadModule :: FilePath -> ModuleName -> Ghc ModSummary
- type TypedModule = Ann UModule IdDom SrcTemplateStage
- parseTyped :: ModSummary -> Ghc TypedModule
- data UnsupportedExtension = UnsupportedExtension String
- trfProblem :: String -> a
- withAlteredDynFlags :: GhcMonad m => (DynFlags -> m DynFlags) -> m a -> m a
- forceCodeGen :: ModSummary -> ModSummary
- codeGenDfs :: DynFlags -> DynFlags
- forceAsmGen :: ModSummary -> ModSummary
- modSumNormalizeFlags :: ModSummary -> ModSummary
- normalizeFlags :: DynFlags -> DynFlags
- readSrcSpan :: String -> RealSrcSpan
- readSrcLoc :: String -> RealSrcLoc
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
pprWarning :: Warn -> SDoc Source #
reloadPkgDb :: Ghc () Source #
Reloads the package database based on the session flags
initGhcFlags :: Ghc () Source #
Initialize GHC flags to default values that support refactoring
initGhcFlagsForTest :: Ghc () Source #
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.
keyFromMS :: ModSummary -> SourceFileKey Source #
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.
data UnsupportedExtension Source #
Constructors
UnsupportedExtension String |
Instances
Show UnsupportedExtension Source # | |
Defined in Language.Haskell.Tools.Refactor.Prepare Methods showsPrec :: Int -> UnsupportedExtension -> ShowS # show :: UnsupportedExtension -> String # showList :: [UnsupportedExtension] -> ShowS # | |
Exception UnsupportedExtension Source # | |
Defined in Language.Haskell.Tools.Refactor.Prepare Methods toException :: UnsupportedExtension -> SomeException # fromException :: SomeException -> Maybe UnsupportedExtension # |
trfProblem :: String -> a Source #
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
codeGenDfs :: DynFlags -> DynFlags Source #
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