haskell-tools-ast-trf-0.1.2.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 :: (StructuralTraversable node, Data sema, Data (node (NodeInfo sema SpanInfo)), Typeable node) => Map SrcSpan [Located AnnotationComment] -> Ann node (NodeInfo sema SpanInfo) -> Ann node (NodeInfo sema SpanInfo) 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 :: StructuralTraversable node => Ann node (NodeInfo sema SpanInfo) -> [SrcSpan] Source #

resizeAnnots :: forall node sema. (Data sema, Data (node (NodeInfo sema SpanInfo)), Typeable node) => [((SrcLoc, SrcLoc), Located AnnotationComment)] -> Ann node (NodeInfo sema SpanInfo) -> Ann node (NodeInfo sema SpanInfo) Source #

type ExpandType elem sema = Ann elem (NodeInfo sema SpanInfo) -> State [((SrcLoc, SrcLoc), Located AnnotationComment)] (Ann elem (NodeInfo sema SpanInfo)) Source #

expandAnnot :: forall elem sema. ExpandType elem sema 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.

expandAnnotToFunArgs :: ExpandType TypeSignature sema Source #