On 28 Mar 2009, at 09:54, Bulat Ziganshin wrote:

Hello haskell-prime,

as we know, the following code

action x y >>= \v -> do

can be shortened to following

v <- action x y



but there is one more very popular 'do' pattern, with a 'do' block
passed as a parameter:

for list $ \element -> do
 ...

or

bracket createDialog destroyDialog $ \dialog -> do
...


what about adding one more 'do' sugar that will allow to move
variable name to the left, such as

for element in list do
or
with dialog in bracket createDialog destroyDialog do

or just

element <-- for list do
dialog <-- bracket createDialog destroyDialog do

?

In all honesty, I find the idea of adding yet more "imperative" looking stuff to do notation an appalling idea. We already get problems because people read do notation and think it means "execute this in sequence" (see threads about lazy IO not doing what's expected for example).

As an aside, while these are merely syntactic sugars, I find the idea of attacking the problem with syntax to be somewhat silly as well. This simply adds a special syntax for another couple of cases that crop up occasionally. What do we do when we have another, and another, and another, do we keep just adding more and more syntax?

Bob

_______________________________________________
Haskell-prime mailing list
Haskell-prime@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-prime

Reply via email to