<p dir="ltr">Yeah, after my first couple of significant Haskell projects I came to the conclusion that having (>>=) instead of (=<<) as the "canonical bind" is a wart. (>>=) makes for clean desugaring of do notation, but obscures that (a -> m b) -> (m a -> m b) intuition, which I think is more important pedagogically and also tends to be cleaner in non-do monadic code.</p>
<p dir="ltr">To a beginner, flip is an easy mechanical concept, but analyzing the resultant type for new insights is not a habit yet. The one whose purpose is purely mechanical should be "the flipped one."</p>
<div class="gmail_quote">On Dec 14, 2015 10:41 AM, "Joel Williamson" <<a href="mailto:joel.s.williamson@gmail.com">joel.s.williamson@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">This function is actually in the Prelude as (=<<).</p>
<br><div class="gmail_quote"><div dir="ltr">On Mon, 14 Dec 2015, 13:17 Dániel Arató <<a href="mailto:exitconsole@gmail.com" target="_blank">exitconsole@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 14/12/2015, Raja <<a href="mailto:rajasharan@gmail.com" target="_blank">rajasharan@gmail.com</a>> wrote:<br>
> So extending this interpretation - can I swap the two parameters (?)<br>
><br>
> Now my new hypothetical interpretation becomes:<br>
><br>
> (>>=) :: (a -> m b) -> m a -> m b<br>
<br>
Sure,<br>
bind' :: Monad m => (a -> m b) -> m a -> m b<br>
bind' = flip (>>=)<br>
<br>
> If i further add parens:<br>
><br>
> (>>=) :: (a -> m b) -> (m a -> m b)<br>
<br>
Yeah, that's exactly the same thing. Types are right associative.<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div>
<br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
<br></blockquote></div>