-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
I'm using ghc-exactprint
to modify some source code.
I parse a haskell module using parseModuleFromString
and obtain (Anns, ParsedSource)
Then I modify that ParsedSource
and obtain a new ParsedSource
.
I tried using addAnnotationsForPretty
in the following manner:
Right (oldAnns, parsedSrc) -> do
let newSrc = someModificationFunction parsedSrc
let newAnns = addAnnotationsForPretty [] newSrc oldAnns
pure $ exactPrint newSrc newAnns
When I do this, the file is printed without language extensions and formatting is lost (I'm guessing that since the modified annotations don't match with the new ParsedSource
, the annotations are being discarded/not being modified as expected by addAnnotationsForPretty
.
What is the best way to modify the existing annotations in order for them to match up/make sense/accomodate for the changes in the ParsedSource
?
Metadata
Metadata
Assignees
Labels
No labels