[Haskell-cafe] Re: Use of abbreviations in Haskell

Achim Schneider barsoap at web.de
Fri Jan 2 15:04:27 EST 2009


Colin Paul Adams <colin at colina.demon.co.uk> wrote:

> >>>>> "Achim" == Achim Schneider <barsoap at web.de> writes:
> 
>     Achim> OTOH, I don't like the idea of having to write "Attribute"
>     Achim> all the time, and neither want to write pages of
> 
>     Achim> attrKey = Attribute.key
> 
>     Achim> for 1000-element records (or TH to tackle standard language
>     Achim> problems, for that matter), so there has to be some way for
>     Achim> library users to shorten code without being masochistic,
>     Achim> somewhat like this:
> 
>     Achim> A = Attribute
> 
> Nay, there's no tax on keystrokes.
> 
> Code is far more often read than written.
>
Say, did you ever read Java and wondered why you have to continuously
scroll to the right albeit using a 500-column terminal?

Exceedingly long names are fine to organise a large library, but becomes
burdensome when code only uses a subset of it... which is usually the
case.

_both_ in reading and writing. The longer identifiers are, the shorter
information distance between two related ones tends to be, as in

generateMapThatTakesAFooAndReturnsABarBydoingBaz

vs.

generateMapThatTakesAFuAndReturnsABarBydoingBaz

compare this with locally-defined aliases 

mapOfFoo

and

mapOfFu


Short notation isn't the problem, missing explanation of it is.[1]
Currently, you can observe stuff like

data Abst -- raction
    = Foo
    | Bar 

in my code. I don't mind making that a language feature for increased
profit.


Anyway, my code tends to get refactored more than being read or
written. I want to finish typing _before_ the next idea kicks in.


[1] This, as a side note, also tends to make me hate academics.

-- 
(c) this sig last receiving data processing entity. Inspect headers
for copyright history. All rights reserved. Copying, hiring, renting,
performance and/or quoting of this signature prohibited.




More information about the Haskell-Cafe mailing list