
On Tue, Nov 25, 2008 at 09:09:47PM -0800, cm wrote:
From: "Tillmann Rendel"
[...] However, I don't see why it would be a good idea. The obvious disadvantage is making the syntax more complicated, and more fragile. For example, you no longer could move an expression inside a brackets while refactoring your code.
Regarding possible advantages: Do you have a specific use case in mind, which could be written easier or cleaner with this list syntax?
I would just like as simple an input syntax as possible (minimum of punctuation) for interactive use, for both lists and tuples. For instance, if all entries in a list or tuple are numbers, then I think eliminating the commas would be convenient and look nicer.
I can probably count on one hand the number of times I've had to literally type in an explicit list of more than three or four elements -- mostly because Haskell has so many easy ways to algorithmically construct lists (list comprehensions, Prelude functions like filter, map, unfoldr, replicate, repeat, etc.). But I can see how this would be annoying when doing certain things. Why not use a lightweight custom list-parser function? Something like this: l = map read . words Then you could type permute (2,3,4) (l "7 9 11 0 1 5") which is still a little extra clutter, but surely much nicer than typing all the commas. -Brent