We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encloseSep
Currently encloseSep is defined like
encloseSep l r s ds = case ds of [] -> l <> r [d] -> l <> d <> r _ -> cat (zipWith (<>) (l : repeat s) ds) <> r
Taking in mind that cat = group . vcat the last line is equivalent to
cat = group . vcat
_ -> group (vcat (zipWith (<>) (l : repeat s) ds)) <> r
This works fine in case we want r to be in one line with last element:
r
[ 1 , 2 , 3 ]
But if we want it to be at the next line:
it (with r = line <> "]") won't group correctly:
r = line <> "]"
[ 1, 2, 3 ]
since r is out of group scope in the current definition of encloseSep.
group
I propose to change last line in the definition of the encloseSep in such way, that r will be grouped in all cases:
encloseSep l r s ds = group $ case ds of [] -> l <> r [d] -> l <> d <> r _ -> vcat (zipWith (<>) (l : repeat s) ds) <> r
This won't change behavior when r doesn't contain line (like list and tupled), but will produce better behavior in this case.
line
list
tupled
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Currently
encloseSep
is defined likeTaking in mind that
cat = group . vcat
the last line is equivalent toThis works fine in case we want
r
to be in one line with last element:But if we want it to be at the next line:
it (with
r = line <> "]"
) won't group correctly:since
r
is out ofgroup
scope in the current definition ofencloseSep
.I propose to change last line in the definition of the
encloseSep
in such way, thatr
will be grouped in all cases:This won't change behavior when
r
doesn't containline
(likelist
andtupled
), but will produce better behavior in this case.The text was updated successfully, but these errors were encountered: