[Haskell-beginners] Possible to update Haskell syntax
byorgey at seas.upenn.edu
Wed Nov 26 10:33:25 EST 2008
On Tue, Nov 25, 2008 at 09:09:47PM -0800, cm wrote:
> From: "Tillmann Rendel" <rendel at daimi.au.dk>
>> 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.
More information about the Beginners