* (previous commit) backed out 'ambient round trip test' CPP thing in Builtin.hs - also it turned out
it was anyway only kicking in on my tests and on parsing of Builtins! Would need to make it kick in during file parsing.
* Nest and group App chains properly
* Some extra nesting/grouping in foralls
Also fix rendering of unary tuples so they come out as `Pair a ()` rather than the ambiguous `(a)`.
Adding a #define line to Builtin.hs (see the code), and running the tests, instruments
every call to Builtin.t, to test that the pretty-printer and parser are consistent, i.e.
that `parse . pretty = id` on that input.
Running this didn't throw up any new problems in the Type pretty-printer. (It did throw up
a known limitation - lack of reversal of generalizeEffects - which is also covered by a pending
test in the suite.)
People may prefer that I take this code out again?
* Various tidy-ups.
* Fix bug with nested arrows.
* Enable ' sugar for delay even for chained delays.
* Add a 'Group' node everywhere parentheses might be output.
Also added a note to say I need to make it undo the effect of generalizeEffects. But I plan to leave that til after the Term printer is done.
Got through the confusion that was preventing me debug the "a ->{e} 'b" case.
Worked around lexer limitation in "a ->'{e} b" by rendering as "a -> '{e} b".
Realised that failure of "''a" is just a lexer limitation - "'('a)" works - so
intend to remove the code I added to prevent pretty-printer outputting chained
delays using the ' sugar.
Add line-break points at
* the space in a function application
* the space before the -> of an arrow
* the space after a comma in an effect list.
Presumably we might one day want to be able to express a preference between
breaking lines at these various points, and be able to control where
we indent to after the line break.
Still need to re-sugar pairs (,) and delay '
Also look into a regression where it seems like "Pair a b" is being parsed
as "Pair a (Pair b ())" (or at least printed that way).
As per Paul's comment, except the for the extra `Maybe` so we can spot the difference between `a -> b` and `a ->{} b`.
So the pattern returns the following
`(AnnotatedType v a, [(Maybe [AnnotatedType v a], AnnotatedType v a)])`
which gives the spine of function arguments, plus optional ability specifications on each arrow.
Plus use of this pattern in the Type pretty-printer.
Add pretty-printer for types, currently lacking precedence-awareness to suppress superfluous parentheses, and lacking integration with PrettyPrint.hs for line-breaking.
Next step is to fix those omissions, then move on to pretty-printing Terms, and data and effect declarations.