You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 ?
The text was updated successfully, but these errors were encountered:
If you have parsed source code you don't need to use addAnnotationsForPretty - the annotations you have are already sufficient. You should just modify the annotations you got from parsing. If you share some source code, we can help more.
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 newParsedSource
.I tried using
addAnnotationsForPretty
in the following manner: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 byaddAnnotationsForPretty
.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
?The text was updated successfully, but these errors were encountered: