Closed lukaszcz closed 1 year ago
The same issue affects the formatter, but we have no ideas on how to fix it. https://github.com/anoma/juvix/issues/1593
I have been thinking about this today.
Collecting the string comments is an easy task. The hard part is printing them in the appropriate place wihtout storing them in the ast.
I've been looking at the implementation of ghc's exact print
for inspiration. It looks a bit hacky but I'll see what I can get out of it
An interesting note on GHC exact printing annotations: https://gitlab.haskell.org/ghc/ghc/-/wikis/api-annotations
This makes it impossible to e.g. write a comment above an import statement.
It also makes it hard to write a tutorial as a Juvix file and generate nice html output for it.