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

Jared Updike jupdike at gmail.com
Sat Feb 4 17:01:53 EST 2006


>         [a,b,c ; tail]      ===      a :: b :: c :: tail         -- where ::

How is [a,b,c ; tail]   simpler, clearer or less typing than 
a:b:c:tail  ? I think that the commas and semicolons are easy to
confuse.

While we're talking about the aesthetics of "::" and ":", I like how a
line with a type annotation stands out strongly with "::", e.g.
map :: (a -> b) -> [a] -> [b]
Compare this to
map : (a -> b) -> [a] -> [b]
where the identifier looks more connected to the type. You will notice
this is different than ML anyway because in Haskell you can separate
the type annotation and the declaration.

If you are designing your own langauge, you will of course have your
own aesthetics and reasons for doing it your way. As for me, I started
to design (in my head) the "perfect" language (for me), but the more I
learned and used Haskell, the more I realized how carefully designed
it was and how it was better for me to use my efforts to learn from
Haskell (especially conceptually, since the syntax is so transparent
and the ideas are so amazing) than to try to insert clever ideas to
satisfy my own whims. Sure, there are always little things to nitpick,
but on the whole, can you think of more succinct language with more
power? (and less parentheses!) Plus, what other languages let you more
easily add (infix) operators, etc. and change things to fit your whim,
anyway (and still be strongly type!).

Cheers,
  Jared.
--
http://www.updike.org/~jared/
reverse ")-:"


More information about the Haskell-Cafe mailing list