ghc-exactprint

ExactPrint for GHC

Version on this page:0.5.3.1
LTS Haskell 20.24:1.5.0@rev:1
Stackage Nightly 2023-06-04:1.6.1.2
Latest on Hackage:1.7.0.1

See all snapshots ghc-exactprint appears in

Using the API Annotations available from GHC 7.10.2, this library provides a means to round trip any code that can be compiled by GHC, currently excluding lhs files.

It does this with a phased approach

  • Delta - converts GHC API Annotations into relative offsets, indexed by SrcSpan

  • Transform - functions to facilitate changes to the AST, adjusting the annotations generated in the Delta phase to suit the changes.

  • Print - converts an AST and its annotations to properly formatted source text.

Note: requires GHC 7.10.2 or later