Record update vs create has inconsistent bracing #126
Labels
No Label
blocked: dependency
blocked: info-needed
bug
duplicate
enhancement
fixed in HEAD
help wanted
hs:arrows
hs:brackets
hs:classes
hs:comments
hs:do-notation
hs:guards
hs:lists
hs:operators
hs:patterns
hs:records
hs:types
invalid
language extension support
layouting
needs confirmation
priority: high
priority: low
question
revisit before next release
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: hexagoxel/brittany#126
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
I ran brittany (0.9.0.0) over bugsnag-haskell and observed the following two diffs:
Record create:
Notice
{bsUser
.Record update:
Notice
{ beExceptions
.I'd expect these two cases to be handled consistently w.r.t to whitespace within the braces. FWIW, I prefer the version with the whitespace.
Thanks for the awesome project btw, I'm totally down to get involved myself and I've seen you're great at supporting contributors. So if you agree this is a bug and want to point me in the right direction to fix it, please do :)
Yeah I agree that the current behaviour is inconsistent. RecordUpd/RecordCon should have the same spacing. This remind me of #87, which was about the spacing for (parentheses)/tuples, where the current conclusion is roughly:
So one might argue for the parallel choices for records (no spaces for single-line updates). But my personal preference matches yours, i.e. always whitespace for records.
Thanks for the offer. I think that in this case at least the implementation is trivial (basically need to insert/remove
appSep
ordocSeparator
in two lines in Expr.hs). The hard part is the decision about which layout to choose. It always feels a bit strange for me to have the last word, as my preferences are not better than those of other haskell devs. Perhaps the best help would be to update/revise the "rationale" document I have over here. That description over there does not match the current implementation any more. But I think it would be useful to maintain that document for future reference.And now I noticed that I a) never announced that document (did I?) b) do not link to it from the readme c) its source link does not work. Oh and d) I should mention the frontrowed guide. Ah, I'll have to fix those (but not this night).
I think this is good advice: https://chrisdone.com/posts/hindent-5. (It's gratifying to me personally that he went with Tibbe style, which I personally prefer.) There is a good argument against having too many options, and as he says there, "The tooling made it so automatic, that I didn’t have to understand the style or make any style decisions. . . . I completely did a U-turn. So I’m hoping that much of the community can do so too and put aside their stylistic preferences and embrace a standard."
Anyway, +1 to spaces between curly braces.
Added spaces around curly braces for
RecordCon
. Think this is consistent now.@chreekat we did not consider making things configurable here - the question of the right "default" (or the "agreed-upon layout" presuming we don't allow configuration) still needs to be answered.
There is the unfortunate fact that with hindent-5.2.3 (5.2.5 being latest) record spacing usage matched that of brittany before this fix:
hindent output:
But I am not too sure what we should derive from this.
Oh, this is not entirely fixed in another aspect: consider this brittany output:
So at least when allowing hanging indentation, things still differ. I'll fix this later.
My apologies—some of my comments were esoteric, unspecific, and not entirely related to this particular issue. :)
@chreekat no worries :)