
I really like tuple sections and I've wanted them for years. I never use
comprehensions though, so I abstain from the other vote.
--
Robin
On Sun, 19 Jul 2009 08:18:48 -0700
Thomas Hartman
I vote for tuple sections. Very nice!
I don't really see immediate places where I would use the list comprehension improvement so I guess I don't vote for that.
2009/7/19 Neil Mitchell
: Hi Max,
For fun, I spent a few hours yesterday implement support for this syntax in GHC, originally propsed by Koen Claessen:
[k, "=", v, " " | (k, v) <- [("foo", "1"), ("bar", "2")] ["foo", "=", "1", " ", "bar", "=", "2", " "]
This is a generalisation of list comprehensions that allows several items to be concatenated onto the result list at once, by having several comma-separated items before the pipe.
I like the power this feature gives, and if it was already in Haskell 98 I'd certainly have used it a few times. I can't think of anything else the syntax could mean, so I don't see a potential for it stealing syntax that might otherwise be reused. However, it doesn't seem that discoverable or natural - I'm not sure I'd have ever guessed that such a feature might exist.
P.S. I also implemented tuple sections (http://hackage.haskell.org/trac/ghc/ticket/3377#comment:3) which are a lot more useful:
Yay! Discoverable, useful and really common in practice - a brilliant extension :-)
Thanks
Neil