[Haskell-cafe] Re: Allowing hyphens in identifiers

Richard O'Keefe ok at cs.otago.ac.nz
Wed Dec 9 17:54:22 EST 2009


On Dec 9, 2009, at 10:54 PM, Maciej Piechotka wrote:
> You mean to parse a - b differently then a-b? You don't have the  
> problem
> in LISP as AFAIR you use (- a b) but in Haskell it would be a problem.

It's a problem that COBOL solved a long time ago:
	COMPUTE INCREASED-DEBT = TOTAL-EXPENSES - AFTER-TAX-INCOME.
Haskell already has this problem with ".", where we generally need
to put spaces around "." with the meaning "composition" and not
put spaces around other uses.

This is something someone could easily try out by writing a trivial
preprocessor to convert hyphens with letters on each side to
underscores.  See how it works.

Given the amazinglyUglyAndUnreadably baStudlyCaps namingStyle that
went into Haskell forNoApparentReasonThatIHaveEverHeardOf, it might
be nice to have a wee preprocessor that turned
	<lower case letter one> _ <lower case letter two>
into	<lower case letter one> <Upper case letter two>

so that I could write take_while and Haskell could see takeWhile.
[I'm writing this in MacOS X Mail.  "takeWhile" is underlined in
red as a spelling mistake, "take_while" is not.  Maybe they know
something...]

Here is such a preprocessor.  This is meant for people to try out.
I don't claim that it's perfect, it's just a quick hack.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: hspp.hs
Type: application/octet-stream
Size: 1994 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20091209/e7a4b949/hspp.obj
-------------- next part --------------



More information about the Haskell-Cafe mailing list