haskell-prettyprinter / haskell-prettyprinter/prettyprinter
Define `vsepHard`
- Dominant language
- Haskell
- Stars
- 309
- Forks
- 43
- Avg merge
- 21h 25m
- Merged PRs (30d)
- 1
Description
Define
```
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 `group`ed, but I think the simple approach of "just always break" is often useful.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.