Simple records are supports. The tests cover:
- single records
- multi-field types
- columnized alignment
- basic deriving
- deriving strategies
- existential quanitification
A few items block merger
- retaining comments
A few items can be deferred:
- normal types
- sum types
- Finish consolidation, clearing a TODO
- Fix two comment placement issues around record wildcards
- Fix regression in brittany-0.12 about layouting large
(multiline) record field updates
`OverloadedLabels` is a simple enough extension to parse and format. It
is becoming more common with use of `generic-lens`. Since it can be
treated as a `HsVar` its implementation only requires using `docLit`,
along with some marshalling for dealing with `FastString`.
- Normalize spaces on type alias lhs. unnecessary spaces were
retained previously, e.g.
"type ( ( a :%: b ) c ) = (a , c)"
had non-optimal output
- Clean up separator usage
- Remove backend hacks (to some degree)
- Minor reformatting and premature optimization
Both record construction and record layouting have very similar
constructions. These each had their own layouter with slightly different
variations. Variations here lead to subtley different bugs in layout for
nearly identicle syntactic forms.
The record update logic is more advanced and respects `IndentPolicyLeft`.
Instead of keeping these layouters distinct we can consolidate
construction logic into the update logic. This results in a smaller
volume of code and more uniform layouting of syntax for these simlilar
forms.
Record constructors with fields and wildcards are not included in this
consolidation. A TODO has been left to handle this consolidation later.
This fixes the code-path for the commandline interface
(unfortunately not covered by our testsuite).
The other code-path should be covered by the changes in
https://github.com/alanz/ghc-exactprint/pull/68.
Previously, we could only import a type operator with no subsequent
list, i.e.
import Foo ( (:.) )
was fine, but
import Foo ( (:.)(..) )
import Foo ( (:.)((:.) )
import Foo ( (:.)(A, b) )
would all break. Brittany would attempt to output them as
import Foo ( :.(..) )
import Foo ( :.((:.) )
import Foo ( :.(A, b) )
I believe the problem was that although `ieName <$> lie` was returning
an `IEWrappedName` with the same contents as used in `layoutWrapped`,
it had different location annotations; and the parentheses are
apparently saved in the location annotations.