vsepHard :: [ Doc a ] -> Doc a
vsepHard = concatWith (\x y -> x <> hardline <> y)
This is a missing function. We have n-ary concatenation functions for various separators: non-breaking spaces, breaking spaces, lines, softlines... but not hardlines.
vsepHard is useful when you have things that you just never want to lay out on a single line. For example, in a programming language you might define let-bindings like so
let
x = 1
y = 2
in t
I always want the x and y bindings to be on separate lines. A more sophisticated version might use flatAlt to use a different syntax when grouped, but I think the simple approach of "just always break" is often useful.
Define
This is a missing function. We have n-ary concatenation functions for various separators: non-breaking spaces, breaking spaces, lines, softlines... but not hardlines.
vsepHard
is useful when you have things that you just never want to lay out on a single line. For example, in a programming language you might define let-bindings like soI always want the
x
andy
bindings to be on separate lines. A more sophisticated version might useflatAlt
to use a different syntax whengroup
ed, but I think the simple approach of "just always break" is often useful.