haskell-src-exts-sc-0.1.0.6: Pretty print haskell code with comments

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.Exts.SimpleComments

Contents

Synopsis

Data types

data CodeComment Source #

Annotate AST with comments.

Constructors

CodeComment 

Fields

  • ccPos :: !CommentPos

    How to place comment

  • ccSym :: !Char

    Special character to prepend to the first line keeping the alignment; e.g. * for haddock sections, '|' for top-level haddock declarations. If ' '(space) is used, no additional indentation is added.

  • ccTxt :: !String

    Content of a comment (can be multiline)

Generate source code

ppWithCommentsStyleModeParseMode :: Style -> PPHsMode -> ParseMode -> Module (Maybe CodeComment) -> (Module SrcSpanInfo, [Comment]) Source #

Run pretty print and parse to obtain SrcSpanInfo, then gradually insert comments.

Convenience functions

preComment :: String -> Maybe CodeComment Source #

Add haddock-style comment above some definition

postComment :: String -> Maybe CodeComment Source #

Add haddock-style comment below some definition

secComment :: String -> Maybe CodeComment Source #

Add haddock-style section (*), use it on definitions in an export list.