ConcatDoc is a Doc node that concatenates two child documents, preserving output order by printing the left child before the right. section 9.3.1
ConcatDoc participates in document construction and iterative pretty printing:
- Create it with Concat(left, right), or use the overloaded + operator as a synonym for document concatenation. section 9.3.1
- During Fits, test the left child first, then test the right child in the width remaining after the left child. section 9.3.3
- During Pretty, push or print the left child before the right child while carrying group-fit and indentation state. section 9.3.4
- Each processed ConcatDoc can increase the explicit work stack by one, so stack space is bounded by the number of ConcatDocs. section 9.3.3
Building a formatted expression
Combining foo, bar, parentheses, operators, and optional breaks produces Foo.Bar(xx + yy * zz) at width 30, Foo.Bar(\n xx + yy * zz) at width 20, and a more deeply broken layout at width 15.
