Document the factors behind formatting
There's an underlying theme in all of the issues regarding formatting: the factors behind formatting are not understood. We should document what motivates a format for a syntactic construct. The intent isn't to attempt to appease everyone, but to let people know what decisions are being made.
Some of these factors are (in no particular order):
-
diffability of the code.- A big part of writing code is that it evolves over time.
- Prioritizing signal over noise in diffs is a pretty big motivator behind
purty.
- Consistency of formatting.
- Two constructs that are formatted differently should have an important purpose for being formatted differently.
- Readability of formatting.
- What is meant here is that the formatting makes the construct easier to digest in isolation.
- We need a better term for this that isn't couched in subjective qualities like familiarity and aesthetics.
It will also be useful to mention which factors are not decision makers. Some of these factors are (in no particular order):
- Familiarity with other code currently in the wild in PS.
- It doesn't really matter if everyone is doing something some way in PS.
- Appeals to popularity are a logical fallacy for a reason.
- E.g. There are plenty of modules in PS in the wild that start with
Data.orControl.and nobody has been able to explain why that is or why we continue doing it.
- Familiarity with other code in different languages (like elm or Haskell).
- PS is not these other languages.
- There are some decisions made for PS that tend to make formatting a certain way better than others.
- Most other languages have different factors behind why they are the way they are.
- Line length.
- Altering format based on line length tends to produce more noise in diffs than not.
- Compactness or verbosity.
- Neither one is inherently better than the other.
- Something can be formatted compactly and be an improvement, or it could be the other way.