[Haskell-cafe] Readable Haskell
Taeer Bar-Yam
taeer at necsi.edu
Sun Sep 20 16:33:11 UTC 2020
Can we agree that it's possible to go too far? Even in the global scope.
https://github.com/Quotation/LongestCocoa.
I think another factor that comes into play is how frequently you use the
function/value. If it comes up only once in a while, then every time someone
encounters it they are likely to have to remind themselves what all the
abreviations mean. If it comes up more frequently, then they likely already saw
it 10 lines ago, and remember. If it comes up very frequently, then whatever
name you assign it takes on its own meaning. Think about `map` or, in bash land
`ls` and `cd`. Unless you just started using bash, you're not going to think
"Oh. cd stands for 'change directory'". It's just… cd.
And at the same time, using a long name for something that's going to come up
every couple of lines is, IMO, distracting. Having all of the information be
within what your eye can easily take in at once has huge advantages. Not to
mention, can you imagine writing `changeDirectory` and `printDirectoryContents`
every time?
It's a balancing act. Obviously, the opposite extreme carries its own problems.
--Taeer
More information about the Haskell-Cafe
mailing list