Safe Haskell | None |
---|---|
Language | Haskell2010 |
Basic utilities and types for defining refactorings.
Synopsis
- runRefactor :: ModuleDom -> [ModuleDom] -> Refactoring -> Ghc (Either String [RefactorChange])
- localRefactoring :: LocalRefactoring -> Refactoring
- localRefactoringRes :: ((UnnamedModule -> UnnamedModule) -> a -> a) -> UnnamedModule -> LocalRefactor a -> Refactor a
- insertText :: SourceInfoTraversal p => [(SrcSpan, String, String)] -> p dom SrcTemplateStage -> p dom SrcTemplateStage
- addGeneratedImports :: [Name] -> Module -> Module
- registeredNamesFromPrelude :: [Name]
- otherNamesFromPrelude :: [String]
- qualifiedName :: Name -> String
- referenceName :: Name -> LocalRefactor (Ann UName IdDom SrcTemplateStage)
- referenceOperator :: Name -> LocalRefactor (Ann UOperator IdDom SrcTemplateStage)
- referenceName' :: ([String] -> Name -> Ann nt IdDom SrcTemplateStage) -> Name -> LocalRefactor (Ann nt IdDom SrcTemplateStage)
- referenceBy :: ([String] -> Name -> Ann nt IdDom SrcTemplateStage) -> Name -> [Ann UImportDecl IdDom SrcTemplateStage] -> Ann nt IdDom SrcTemplateStage
Documentation
runRefactor :: ModuleDom -> [ModuleDom] -> Refactoring -> Ghc (Either String [RefactorChange]) Source #
Performs the given refactoring, transforming it into a Ghc action
localRefactoring :: LocalRefactoring -> Refactoring Source #
Wraps a refactoring that only affects one module. Performs the per-module finishing touches.
localRefactoringRes :: ((UnnamedModule -> UnnamedModule) -> a -> a) -> UnnamedModule -> LocalRefactor a -> Refactor a Source #
Transform the result of the local refactoring
insertText :: SourceInfoTraversal p => [(SrcSpan, String, String)] -> p dom SrcTemplateStage -> p dom SrcTemplateStage Source #
Re-inserts the elements removed from the AST that should be kept (for example preprocessor directives)
addGeneratedImports :: [Name] -> Module -> Module Source #
Adds the imports that bring names into scope that are needed by the refactoring
qualifiedName :: Name -> String Source #
referenceName' :: ([String] -> Name -> Ann nt IdDom SrcTemplateStage) -> Name -> LocalRefactor (Ann nt IdDom SrcTemplateStage) Source #
Create a name that references the definition. Generates an import if the definition is not yet imported.
referenceBy :: ([String] -> Name -> Ann nt IdDom SrcTemplateStage) -> Name -> [Ann UImportDecl IdDom SrcTemplateStage] -> Ann nt IdDom SrcTemplateStage Source #
Reference the name by the shortest suitable import