[Haskell-cafe] Why is $ right associative instead ofleftassociative?

John Hughes rjmh at cs.chalmers.se
Sun Feb 5 10:13:45 EST 2006


Lennart Augustsson wrote:

 > I now think :: for type signatures was a bad mistake.
 > I don't use lists very much.  They are not the right data structure
 > for many things.  So : is not as common as :: in my code.
 > I checked a small sample of code, about 20000 lines of Haskell.
 > It has about 1000 uses of ':' and 2000 of '::'.

Just for interest, I analysed some of my code. Obviously my style is
quite different to yours--my type specialiser of 3,500 lines has 240
conses, and only 22 occurrences of '::'. I seem to be using '::'  a bit more
lately, though, which I suspect is due to using classes much more.
I also checked the Agda source code, about 14,000 lines, with
about 500 occurrences of cons and 640 of '::'. I think the only conclusion
one can draw is that style varies.

 > In my opinion all the special syntactic sugar for lists should go
 > away.  I don't think lists are special enough to motivate it.

What, no list comprehensions??

I'd disagree--sequencing is special, and lists represent it directly.
Don't forget, also, that lists are also much more prevalent in beginners'
code--and nice notation for beginners helps get people started on
Haskell.

 > But this is not what Haskell' is about.  It's supposed to be some
 > modest extensions to Haskell.  Not designing a new perfect language.

Right!

John


More information about the Haskell-Cafe mailing list