The current style (A) for records is:
data Foo
= Foo
{ bar :: Bar,
baz :: Baz
}
I propose the following style (B) for single-constructor records:
data Foo = Foo
{ bar :: Bar,
baz :: Baz
}
Pros
-
The most common style, according to Hackage grep.
-
One-constructor records seem to stay one-constructor records so git diffs don't get worse. (Not sure about this one. Feedback welcome.)
-
Slightly better use of horizontal space.
-
Much better use of vertical space for data-heavy modules – important for people who split their screens horizontally instead of vertically.
Cons
- Still, some diffs are inevitable. Especially annoying when the fields were heavily commented and you have to rewrap the comments.
Unresolved questions
- Should (A) be reformatted into (B)? "Yes" seems like a good answer, but it would be slightly unfortunate if it was impossible to break a
data ReallyReallyReallyReallyLongName = ReallyReallyReallyReallyLongName ... even when requested by the programmerr.
The current style (A) for records is:
I propose the following style (B) for single-constructor records:
Pros
The most common style, according to Hackage grep.
One-constructor records seem to stay one-constructor records so git diffs don't get worse. (Not sure about this one. Feedback welcome.)
Slightly better use of horizontal space.
Much better use of vertical space for
data-heavy modules – important for people who split their screens horizontally instead of vertically.Cons
Unresolved questions
data ReallyReallyReallyReallyLongName = ReallyReallyReallyReallyLongName ...even when requested by the programmerr.