ormolu-0.7.7.0: A formatter for Haskell source code

Safe Haskell | None
Language | GHC2021

Ormolu.Printer.Comments

Description

Helpers for formatting of comments. This is low-level code, use Ormolu.Printer.Combinators unless you know what you are doing.

Synopsis

- spitPrecedingComments :: RealSrcSpan -> R ()
- spitFollowingComments :: RealSrcSpan -> R ()
- spitRemainingComments :: R ()
- spitCommentNow :: RealSrcSpan -> Comment -> R ()
- spitCommentPending :: CommentPosition -> RealSrcSpan -> Comment -> R ()

# Documentation

spitPrecedingComments #

Arguments

:: RealSrcSpan | Span of the element to attach comments to
-> R () |

Output all preceding comments for an element at given location.

spitFollowingComments #

Arguments

:: RealSrcSpan | Span of the element to attach comments to
-> R () |

Output all comments following an element at given location.

spitRemainingComments :: R () #

Output all remaining comments in the comment stream.

spitCommentNow :: RealSrcSpan -> Comment -> R () #

Output a `Comment` immediately. This is a low-level printing function.

spitCommentPending :: CommentPosition -> RealSrcSpan -> Comment -> R () #

Output a `Comment` at the end of correct line or after it depending on `CommentPosition`. Used for comments that may potentially follow on the same line as something we just rendered, but not immediately after it.