Safe Haskell | None |
---|---|
Language | Haskell98 |
- getTargetGhc :: TargetModule -> RefactGhc ()
- parseSourceFileGhc :: FilePath -> RefactGhc ()
- runRefacSession :: RefactSettings -> Options -> RefactGhc [ApplyRefacResult] -> IO [FilePath]
- runRefactGhcCd :: RefactGhc a -> RefactState -> Options -> IO (a, RefactState)
- applyRefac :: RefactGhc a -> RefacSource -> RefactGhc (ApplyRefacResult, a)
- refactDone :: [ApplyRefacResult] -> Bool
- class (Data t, Data t1) => Update t t1 where
- fileNameFromModSummary :: ModSummary -> FilePath
- getModuleName :: ParsedSource -> Maybe (ModuleName, String)
- clientModsAndFiles :: ModulePath -> RefactGhc [TargetModule]
- serverModsAndFiles :: GhcMonad m => ModuleName -> m [ModSummary]
Managing the GHC / project environment
getTargetGhc :: TargetModule -> RefactGhc () Source
parseSourceFileGhc :: FilePath -> RefactGhc () Source
Parse a single source file into a GHC session
The bits that do the work
:: RefactSettings | |
-> Options | ghc-mod options |
-> RefactGhc [ApplyRefacResult] | The computation doing the
refactoring. Normally created
via |
-> IO [FilePath] |
Manage a whole refactor session. Initialise the monad, load the whole project if required, and then apply the individual refactorings, and write out the resulting files.
It is intended that this forms the umbrella function, in which applyRefac is called
runRefactGhcCd :: RefactGhc a -> RefactState -> Options -> IO (a, RefactState) Source
:: RefactGhc a | The refactoring |
-> RefacSource | where to get the module and toks |
-> RefactGhc (ApplyRefacResult, a) |
Apply a refactoring (or part of a refactoring) to a single module
refactDone :: [ApplyRefacResult] -> Bool Source
Returns True if any of the results has its modified flag set
class (Data t, Data t1) => Update t t1 where Source
:: t | The syntax phrase to be updated. |
-> t | The new syntax phrase. |
-> t1 | The contex where the old syntax phrase occurs. |
-> RefactGhc t1 | The result. |
Update the occurrence of one syntax phrase in a given scope by another syntax phrase of the same type
(Data t, OutputableBndr n, DataId n) => Update (LHsType n) t Source | |
(Data t, OutputableBndr n, DataId n) => Update (LPat n) t Source | |
(Data t, OutputableBndr n, DataId n) => Update (Located (HsExpr n)) t Source | |
(Data t, OutputableBndr n1, OutputableBndr n2, DataId n1, DataId n2) => Update (LHsBindLR n1 n2) t Source |
getModuleName :: ParsedSource -> Maybe (ModuleName, String) Source
Extract the module name from the parsed source, if there is one
clientModsAndFiles :: ModulePath -> RefactGhc [TargetModule] Source
Return the client modules and file names. The client modules of module, say m, are those modules which directly or indirectly import module m.
serverModsAndFiles :: GhcMonad m => ModuleName -> m [ModSummary] Source
Return the server module and file names. The server modules of module, say m, are those modules which are directly or indirectly imported by module m. This can only be called in a live GHC session TODO: make sure this works with multiple targets. Is that needed? No?