Define `vsepHard`
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 65/100
Research direction
Start by locating the existing n-ary concatenation functions for non-breaking spaces, breaking spaces, lines, and softlines. Add the missing vsepHard function alongside them using the issue's specified behavior, then verify that it keeps every pair of documents on separate lines and matches the surrounding API style.
Written by the indexing model from the issue text.
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 grouped, but I think the simple approach of "just always break" is often useful.
- Dominant language
- Haskell
- Stars
- 309
- Forks
- 43
- Avg merge
- 21h 25m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from haskell-prettyprinter/prettyprinter
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
-
Feature request
Difficulty 3/5 1-2 days Newbie friendliness 55/100
haskell-prettyprinter/prettyprinter#288 · 3 comments ·
-
Help wanted
Difficulty 5/5 Over a week Newbie friendliness 15/100
haskell-prettyprinter/prettyprinter#272 · 7 comments · 3 reactions ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
haskell-prettyprinter/prettyprinter#264 · 7 comments ·
-
Feature request
Difficulty 3/5 1-2 days Newbie friendliness 45/100
haskell-prettyprinter/prettyprinter#259 · 2 comments · 1 reaction ·
All issues in haskell-prettyprinter/prettyprinter
Similar issues
-
chore
Difficulty 1/5 Under an hour Newbie friendliness 91/100
alunduil/alunduil-chezmoi#792 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
koalaman/shellcheck#3539 ·
-
time-manager-0.4.0 Openfailure: bounds
Difficulty 1/5 Under an hour Newbie friendliness 72/100
commercialhaskell/stackage#8122 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
objectionary/phino#1350 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100