$ package:ghc

Concatenate with an optional newline
Join two docs together vertically. If there is no vertical overlap it "dovetails" the two onto one line.
Join two SDoc together vertically
Above, except that if the last line of the first argument stops at least one position before the first line of the second begins, these two lines are overlapped. For example:
text "hi" $$ nest 5 (text "there")
lays out as
hi   there
rather than
hi
there
$$ is associative, with identity empty, and also satisfies
  • (x $$ y) <> z = x $$ (y <> z), if y non-empty.
Above, with no overlapping. $+$ is associative, with identity empty.