2008/5/13 Abhay Parvate <[EMAIL PROTECTED]>:
> Yes, I had always desired that the operator >>= should have been right
> associative for this short cut even when written without the 'do' notation.

You pretty much always want "a >>= b >>= c" to parse as "(a >>= b) >>=
c" and not "a >>= (b >>= c)". In the latter case, the two uses of
(>>=) aren't in the same monad.

You can get desired effect with the Kleisli composition operator
(>=>), which is in recent versions of Control.Monad. Unfortunately, it
has the same precedence as (>>=), so you can't use them together
without parentheses.

Using it, "a >>= b >>= c" can be rewritten "a >>= (b >=> c)" which is
short for "a >>= \x -> b x >>= c".

-- 
Dave Menendez <[EMAIL PROTECTED]>
<http://www.eyrie.org/~zednenem/>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to