This change adds an ad-hoc parser for module pragmas to handle
OPTIONS_* pragmas. I did not want to use an existing tokenizer,
because I felt like tokenizing and pretty printing the GHC options
are more prone to error without providing much benefit.
Goals:
* Make the set of combinators clearer and smaller.
* Solve a number of issues, such as those about parse failures related to
patterns.
* Solve the bug from #244.
The idea is very simple, we stop doing this
( foo
, bar
)
and start doing this
( foo,
bar
)
* We switch to trailing commas which solves the indentation issues for
patterns automatically.
* The new general ‘sep’ combinator finally is clear enough, and all the old
zoo of ‘velt’ and ‘velt'’ and ‘sepWith’, etc. which was confusing and
overlapping goes away.
‘ghc-exactprint’ (or perhaps lexer of GHC itself) does a fairly poor job at
associating comments with elements of AST. In many cases the result is not
what you'd expect. We ran into insuperable problems with that to the effect
that correct comment placement were impossible.
The new approach is to exploit the raw position information provided by the
GHC lexer, that is, spans attached to AST elements and comments. This
allowed us to place comments in output in a very precise and satisfactory
fashion.