[Haskell-cafe] Re: Allowing hyphens in identifiers

Luke Palmer lrpalmer at gmail.com
Fri Dec 18 02:14:38 EST 2009

On Thu, Dec 17, 2009 at 10:39 PM, Richard O'Keefe <ok at cs.otago.ac.nz> wrote:
> On Dec 18, 2009, at 5:00 PM, Luke Palmer wrote:
>>  My preferred way to increase the readability of code is to
>> keep names short and *limited in scope*.
> That's good.  Haskell code is chock full of one and two letter
> highly local identifiers.

I am actually rather ambivalent to this practice.  I was referring
more to the 4-8 letter, 1-2 word range: functions named "collect" or
"diagonals" or "split".  A name like this together with a type
signature is frequently enough to uniquely identify the function in
question; without a good name, not so much.

I find one and two letter identifiers the best way in a few
situations, eg. in "map (x:xs) = ...", where there is hardly a better
name for them ("head" and "tail" perhaps... but it is blindly clear
from context what they are...).  On the other hand, a function like
Martin Escardo's:

> find_vii :: (Cantor -> Bool) -> Cantor
> find_vii p = b
>  where b = id'(\n -> if q n (find_vii(q n)) then Zero else One)
>        q n a = p(\i -> if i < n then b i else if i == n then Zero else a(i-n-1))

is pretty rough reading for me.


More information about the Haskell-Cafe mailing list