apply-refact-0.1.0.0: Perform refactorings specified by the refact library.

Safe HaskellNone
LanguageHaskell2010

Refact.Utils

Contents

Synopsis

Synonyms

Monad

type M a = State Anns a Source

Utility

mergeAnns :: Anns -> Anns -> Anns

Left bias pair union

modifyAnnKey :: (Data old, Data new, Data mod) => mod -> Located old -> Located new -> M (Located new) Source

Perform the necessary adjustments to annotations when replacing one Located thing with another Located thing.

For example, this function will ensure the correct relative position and make sure that any trailing semi colons or commas are transferred.

replaceAnnKey :: Anns -> AnnKey -> AnnKey -> AnnKey -> AnnKey -> Anns Source

Lower level version of modifyAnnKey

toGhcSrcSpan :: FilePath -> SrcSpan -> SrcSpan Source

Convert a Refact.Types.SrcSpan to a SrcLoc.SrcSpan

findParent :: Data a => SrcSpan -> a -> Maybe AnnKey Source

A parent in this case is an element which has the same SrcSpan