[Haskell-cafe] Why is $ right associative instead of
leftassociative?
Brian Hulley
brianh at metamilk.com
Sun Feb 5 08:10:24 EST 2006
Jon Fairbairn wrote:
> Brian Hulley wrote:
>> <snip>
>
> Not exactly alone; I've felt it was wrong ever since we
> argued about it for the first version of Haskell. ":" for
> typing is closer to common mathematical notation.
>
> But it's far too late to change it now.
>
>> - it's just syntax after all
Well I'm reconsidering my position that it's "just" syntax. Syntax does
after all carry a lot of semiotics for us humans, and if there are centuries
of use of ":" in mathematics that are just to be discarded because someone
in some other language decided to use it for list cons then I think it makes
sense to correct this.
It would be impossible to get everything right first time, and I think the
Haskell committee did a very good job with Haskell, but just as there can be
bugs in a program, so there can also be bugs in a language design, and an
interesting question is how these can be addressed.
For example, in the Prolog news group several years ago, there was also a
discussion about changing the list cons operator, because Prolog currently
uses "." which is much more useful for forming composite names - something
which I also think has become a de-facto inter-language standard. Although
there was much resistance from certain quarters, several implementations of
Prolog had in fact changed their list cons operator (list cons is hardly
ever needed in Prolog due to the [Head|Tail] sugar) to reclaim the dot for
its "proper" use.
My final suggestion if anyone is interested is as follows:
1) Use ":" for types
2) Use "," instead of ";" in the block syntax so that all brace blocks can
be replaced by layout if desired (including record blocks)
3) Use ";" for list cons. ";" is already used for forming lists in natural
language, and has the added advantage that (on my keyboard at least) you
don't even need to press the shift key! ;-)
Regards, Brian.
More information about the Haskell-Cafe
mailing list