One more 'do' pattern
Conal Elliott
conal at conal.net
Sat Mar 28 16:54:55 EDT 2009
Hi Bulat,
Do you have examples of usefulness your sugar for monads besides the one?
Since "do" sugar is notation for general monadic programming, I wouldn't
want to see it made more complex for the sake of just one monad.
- Conal
On Sat, Mar 28, 2009 at 1:54 AM, Bulat Ziganshin
<bulat.ziganshin at gmail.com>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
>
> ?
>
>
> --
> Best regards,
> Bulat mailto:Bulat.Ziganshin at gmail.com
>
> _______________________________________________
> Haskell-prime mailing list
> Haskell-prime at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-prime
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-prime/attachments/20090328/2d38ef84/attachment.htm
More information about the Haskell-prime
mailing list