The desugaring is simpler with the current setup:<br><br>do { e }<br>  =&gt; e<br>do { let p = e; STMTS } <br>  =&gt; let p = e in (do { STMTS })<br>do { e; STMTS }<br>  =&gt; e &gt;&gt; (do { STMTS })<br>do { p &lt;- e; STMTS }<br>
  =&gt; e &gt;&gt;= \x -&gt; case x of { p -&gt; (do { STMTS }) ; _ -&gt; fail &quot;pattern match failure&quot; }<br>       [x is a fresh variable]<br><br>My guess is that &gt;&gt; is infixl because<br>  (1) m &gt;&gt;= f &gt;&gt;= g should make sense<br>
  (2) &gt;&gt; should match fixity and precedence with &gt;&gt;=<br><br><div class="gmail_quote">On Tue, Feb 14, 2012 at 9:50 PM, Michael Baikov <span dir="ltr">&lt;<a href="mailto:manpacket@gmail.com">manpacket@gmail.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Most docs ([1], [2]) about do-notation syntactic sugar tends  to<br>
describe following expressions as equivalent:<br>
<br>
&quot;do { a; b; c }&quot;  and &quot;a &gt;&gt; b &gt;&gt; c&quot;, but they are not: first one gets<br>
de-sugared into  &quot;a &gt;&gt; (b &gt;&gt; c)&quot;, second one is equivalent to &quot;(a &gt;&gt;<br>
b) &gt;&gt; c&quot;, because (&gt;&gt;) is declared using infixl.<br>
<br>
This should not be a problem, monadic law of Associativity states that<br>
&quot;(m &gt;&gt;= f) &gt;&gt;= g  ≡  m &gt;&gt;= (\x -&gt; f x &gt;&gt;= g)&quot;, but this leads to<br>
generating different Core output and may lead to different performance<br>
(and it does, do { Just 4 ; Just 4 ... } is about 2% faster than Just<br>
4 &gt;&gt; Just 4 &gt;&gt; ... if compiled with -O0, but 13% slower when compiled<br>
with -O11)<br>
<br>
This also leads to lots of fun when your monad  breaks Associativity law :)<br>
<br>
Is there any reasons except for those 13% speed gain for this?<br>
<br>
[1]: <a href="http://en.wikibooks.org/wiki/Haskell/do_Notation" target="_blank">http://en.wikibooks.org/wiki/Haskell/do_Notation</a><br>
[2]: <a href="http://book.realworldhaskell.org/read/monads.html#monads.dot" target="_blank">http://book.realworldhaskell.org/read/monads.html#monads.dot</a><br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</blockquote></div><br>