[Haskell-cafe] Re: Allowing hyphens in identifiers

Deniz Dogan deniz.a.m.dogan at gmail.com
Wed Dec 9 18:05:17 EST 2009

2009/12/9 Richard O'Keefe <ok at cs.otago.ac.nz>:
> 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:
> 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.

Is there any flag I can pass to e.g. GHC to make it use the
preprocessor automagically or do I write my own little hack to apply
the preprocessor?

Deniz Dogan

More information about the Haskell-Cafe mailing list