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.
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.
During alt-transform, when gather spacings, previously
we tracked different non-bottom spacings separately even
though they would be treated in the same way during any
future transformations (apart from certain exceptions that
don't practically give better results). Instead we now
merge such spacings into one, giving more space for other
spacings when pruning to the spacings limit.
Arguments of two function applications will only be aligned
if the same function is called in both cases.
The column transform was altered slightly to fix#65
properly as well.
fixes#65, #128
This commit changes infix patterns to utilize `lrdrNameToTextAnn`. This
function allows the logic to avoid introspecting on the constructor
name.
Additionally this adds spaces to all infix operator pattern matches.
Previously infix symbols did not include spaces:
```
foo (x:xs) = _
```
Now they include a space
```
foo (x : xs) = _
```
Brittany was previously only support symbol based infix constructors. It
is common in some libraries (for example Esqueleto) to pattern match on
normal constructors as infix. Brittany was failing in this case by not
wrapping the constructor name in back ticks/spaces. Backticks and spaces
have been added in the case where the constructor contains any alpha
characters.