[Haskell-cafe] Records

Simon Marlow simonmar at microsoft.com
Sun Nov 20 07:40:00 EST 2005

On 19 November 2005 20:53, Ketil Malde wrote:

> Antti-Juhani Kaijanaho wrote:
>> Ketil Malde wrote:
>> [about A.b and A . b potentially meaning different things:]
>>> Syntax that changes depending on spacing is my number
>>> one gripe with the Haskell syntax
>> I've generally considered that one of the good ideas in most current
>> languages (it's not specific to Haskell). ISTR there was a Basic
>>  dialect where IFX=0THENX=X+1
>> and
>>  IF X = 0 THEN X = X + 1
>> meant the same thing.
> My point is that e.g. currently "foo? bar", "foo ?bar" and "foo ? bar"
> have (at least two) different meanings.   Hierarchical naming collides
> with function composition (admittedly only rarely in practice).
> Template haskell collides with list comprehensions.
> Do you really think that is such a great idea?

I think many people agree that this is a bad thing.  It occurs in two
places in Haskell 98, I believe:

  - qualified identifiers (M.T is different from M . T)
  - single-line comments  (--??? is not a comment, but -- ??? is)

Both of these were late additions to Haskell, and if we were starting
from scratch the syntax would probably not have such anomalies.  The
other odd cases that GHC has are all extensions too - you mentioned
implicit parameters and template haskell, there is also GHC's unboxed
values (1#, (#..#)), arrows, and parrays.  I would argue against adding
any of these syntactic anomalies to the standard language, and we should
strive to remove those that we have (e.g. by deprecating the use of '.'
as function composition in favour of something else, thus freeing it up
for use as record/module selection).

I'm assuming you don't consider the distinction between '::' and ': :'
to be a problem - the justification for this is simple and logical: a
double colon '::' is a reserved symbol, in the same way that 'then' is a
reserved identifier.


More information about the Haskell-Cafe mailing list