[Haskell-beginners] Possible to update Haskell syntax
cm at raytheon.com
Wed Nov 26 00:09:47 EST 2008
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.
As a use case, one might have
" permute (2 3 4) [7 9 11 0 1 5]", which would be a function which
cyclically permutes elements 2 3 4 of a list.
Regarding your question of what [a + b c] in "altered consciousness syntax"
would resolve to in real world Haskell, it would be [a, (+), b, c]. [(a +
b) c] would resolve to [a + b, c]. The rule would be that whitespace inside
a bracket becomes a comma delimiter. If there are parentheses inside the
bracket, then the expression inside the parentheses reverts to normal
These are probably not workable ideas. I'm just annoyed by extra
punctuation which I consider to be visual clutter.
More information about the Beginners