ghc-exactprint-0.4.0.0: ExactPrint for GHC

Safe HaskellNone
LanguageHaskell2010

Language.Haskell.GHC.ExactPrint.Print

Description

This module inverts the process performed by Delta. Given Anns and a corresponding AST we produce a source file based on this information.

Synopsis

Documentation

exactPrint :: Annotate ast => Located ast -> Anns -> String Source

Print an AST with a map of potential modified Anns. The usual way to generate such a map is by using one of the parsers in Language.Haskell.GHC.ExactPrint.Parsers.

semanticPrint Source

Arguments

:: (Annotate ast, Monoid b) 
=> (forall a. Data a => Located a -> b -> b)

How to surround an AST fragment

-> (String -> b)

How to output a token

-> (String -> b)

How to output whitespace

-> Located ast 
-> Anns 
-> b 

A more general version of exactPrint which allows the customisation of the output whilst retaining the original source formatting. This is useful for smarter syntax highlighting.

semanticPrintM Source

Arguments

:: (Annotate ast, Monoid b, Monad m) 
=> (forall a. Data a => Located a -> b -> m b)

How to surround an AST fragment

-> (String -> m b)

How to output a token

-> (String -> m b)

How to output whitespace

-> Located ast 
-> Anns 
-> m b 

A more general version of semanticPrint.