haskell-tools-ast-trf-0.2.0.0: Conversions on Haskell-Tools AST to prepare for refactorings

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Tools.AnnTrf.PlaceComments

Contents

Description

This transformation expands nodes to contain the comments that should be attached to them. After this, a normalizing transformation should be performed that expands parents to contain their children.

Synopsis

Documentation

placeComments :: RangeInfo stage => Map SrcSpan [Located AnnotationComment] -> Ann Module dom stage -> Ann Module dom stage Source #

Puts comments in the nodes they should be attached to. Leaves the AST in a state where parent nodes does not contain all of their children.

allElemSpans :: (SourceInfoTraversal node, RangeInfo stage) => Ann node dom stage -> [SrcSpan] Source #

resizeAnnots :: RangeInfo stage => [((SrcLoc, SrcLoc), Located AnnotationComment)] -> Ann Module dom stage -> Ann Module dom stage Source #

type ExpandType elem dom stage = Ann elem dom stage -> State [((SrcLoc, SrcLoc), Located AnnotationComment)] (Ann elem dom stage) Source #

expandAnnot :: forall elem dom stage. RangeInfo stage => ExpandType elem dom stage Source #

Expands tree elements to contain the comments that should be attached to them.

GHC mistakenly parses -- ^ and -- | comments as simple line comments.

isCommentOnNext :: AnnotationComment -> Bool Source #

Checks if a doc comment belongs to the next definition.

isCommentOnPrev :: AnnotationComment -> Bool Source #

Checks if a doc comment belongs to the previous definition.