haskell-tools-prettyprint-0.6.0.0: Pretty printing of Haskell-Tools AST

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Tools.Transform

Description

A module for preparing the representation of the AST for pretty printing.

Synopsis

Documentation

prepareAST :: StringBuffer -> Ann UModule dom RangeStage -> Ann UModule dom SrcTemplateStage Source #

Prepares the AST for pretty printing

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

Puts comments in the nodes they should be attached to. Watches for lexical tokens that may divide the comment and the supposed element. Leaves the AST in a state where parent nodes does not contain all of their children.

after :: AfterBefore i => String -> i -> i Source #

Put the given string before the element if it is not empty

followedBy :: AfterBefore i => String -> i -> i Source #

The given string should follow the element if it is not empty

relativeIndented :: RelativeIndent i => Int -> i -> i Source #

The element should be indented relatively to its parent

minimumIndented :: MinimumIndent i => Int -> i -> i Source #

The elements should be indented at least to the given number of spaces

separatedBy :: String -> ListInfo SrcTemplateStage -> ListInfo SrcTemplateStage Source #

The elements of the list should be separated by the given string by default (might be overridden)

indented :: ListInfo SrcTemplateStage -> ListInfo SrcTemplateStage Source #

The elements of the list should be indented on the same column

(<>) :: SpanInfo SrcTemplateStage -> SpanInfo SrcTemplateStage -> SpanInfo SrcTemplateStage Source #

Concatenates two source templates to produce a new template with all child elements.

fixRanges :: SourceInfoTraversal node => Ann node dom RangeStage -> Ann node dom NormRangeStage Source #

Modifies ranges to contain their children

cutUpRanges :: forall node dom. SourceInfoTraversal node => Ann node dom NormRangeStage -> Ann node dom RngTemplateStage Source #

Creates a source template from the ranges and the input file. All source ranges must be good ranges.

getLocIndices :: SourceInfoTraversal e => Ann e dom RngTemplateStage -> Set (RealSrcLoc, Int) Source #

Assigns an index (in the order they are used) for each range

mapLocIndices :: Ord k => StringBuffer -> Set (RealSrcLoc, k) -> Map k String Source #

Partitions the source file in the order where the parts are used in the AST