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

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Tools.Refactor.Utils.Monadic

Description

Basic utilities and types for defining refactorings.

Synopsis

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

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