[Haskell-cafe] Readable Haskell
MigMit
migmit at gmail.com
Sun Sep 20 21:06:36 UTC 2020
My guess is that most of Café members would agree that if given a choice between buttons with short labels and buttons with long labels they would ask to revert back to CLI. Maybe I'm wrong here, but I think Unix-style CLI is not going anywhere any time soon, regardless of retina screens and any other bells and whistles of modern GUIs. Don't get me wrong, GUIs are great for a lot of specific tasks, but CLI still outshines them in many areas, and I think short command names are a part of a reason for that.
Not just command names, in fact; in a one-liner I would rather write "while read a; do cp $a...; done" than "while read filename; do cp $filename...; done". They are exactly the same, but it's simply easier to deal with a short line — read it, edit it etc.
And, as Haskell makes it easier to use and control local variables, I think it's even more forgiving about short names. In C you'd need a descriptive name simply to make sure you don't use your loop counter somewhere inside the loop; but in Haskell, due to immutability, you don't usually have to worry.
> On 20 Sep 2020, at 21:30, Ignat Insarov <kindaro at gmail.com> wrote:
>
> Command shell is a very old and peculiar human interface — if human at
> all. They had 80 character wide screens and visibly lagging connexion.
> We have retina screens, GPU accelerated rendering and magical
> auto-completion. Imagine those commands were buttons that you could
> press. Would you prefer a button to say _«`ls`»_ or _«list files»_,
> _«`cd`»_ or _«change directory»_? For a vivid example, imagine a web
> site where you have `lgn` and `plrq` instead of _«log in»_ and _«pull
> request»_. Would you like that?
>
> Getting back to Mathematics — this is where abstraction and notation
> come in. We can give names to things and we can use scoping. But
> neither mathematicians nor system administrators invent new
> terminology for every next paper or script — maybe a few key words.
> Industrial programming is yet another thing. I imagine when you have a
> record with a hundred fields it pays off to have longish field labels.
> And you cannot expect the next person to read your code from top to
> bottom so that they get used to its peculiar vocabulary. For example,
> today I am merging two branches of a 10 thousand lines code base that
> diverged last Spring. Guessing the difference between `rslt` and `res`
> is the last thing I need. You do not need to call your context
> _«`ctx`»_ and your result _«`rslt`»_ — there are already words for it.
>
> There was a time when every character needed to be typed and there was
> a rectangle of only some 80×25 characters visible at once. Things have
> changed. I can have two terminals of 119×61 characters each with a
> fixed width font, and perhaps twice that with proportional. The number
> of characters it takes to type an identifier in a smart code editor is
> proportional to the logarithm of the number of identifiers in scope,
> not to their length.
More information about the Haskell-Cafe
mailing list