Safe Haskell | None |
---|---|
Language | Haskell2010 |
Refact.Apply
Synopsis
- applyRefactorings :: Maybe (Int, Int) -> [[Refactoring SrcSpan]] -> FilePath -> [String] -> IO String
- applyRefactorings' :: Maybe (Int, Int) -> [[Refactoring SrcSpan]] -> Anns -> Module -> IO String
- runRefactoring :: Data a => Anns -> a -> AnnKeyMap -> Refactoring SrcSpan -> StateT Int IO (Anns, a, AnnKeyMap)
- parseExtensions :: [String] -> ([Extension], [Extension], [String])
Documentation
Arguments
:: Maybe (Int, Int) | Apply hints relevant to a specific position |
-> [[Refactoring SrcSpan]] |
The |
-> FilePath | Target file |
-> [String] | GHC extensions, e.g., These are in addition to the |
-> IO String |
Apply a set of refactorings as supplied by HLint
Arguments
:: Maybe (Int, Int) | |
-> [[Refactoring SrcSpan]] | |
-> Anns | ghc-exactprint AST annotations. This can be obtained from
|
-> Module | Parsed module |
-> IO String |
Like applyRefactorings
, but takes a parsed module rather than a file path to parse.
runRefactoring :: Data a => Anns -> a -> AnnKeyMap -> Refactoring SrcSpan -> StateT Int IO (Anns, a, AnnKeyMap) Source #
Peform a Refactoring
.
parseExtensions :: [String] -> ([Extension], [Extension], [String]) Source #
Parse the input into (enabled extensions, disabled extensions, invalid input).
Implied extensions are automatically added. For example, FunctionalDependencies
implies MultiParamTypeClasses
, and RebindableSyntax
implies NoImplicitPrelude
.
The input is processed from left to right. An extension (e.g., StarIsType
)
may be overridden later (e.g., by NoStarIsType
).
Extensions that appear earlier in the input will appear later in the output. Implied extensions appear in the end. If an extension occurs multiple times in the input, the last one is used.
>>>
parseExtensions ["GADTs", "RebindableSyntax", "StarIsType", "GADTs", "InvalidExtension", "NoStarIsType"]
([GADTs, RebindableSyntax, GADTSyntax, MonoLocalBinds], [StarIsType, ImplicitPrelude], ["InvalidExtension"])