I&#39;m delighted to see the possibility of adding join as a Monad method. I almost always have an easier time thinking about join than (&gt;&gt;=) and wish I could define join instead of (&gt;&gt;=), without having to pay the cost of defining an additional joinFoo function and then having the actual join function end up implemented via (&gt;&gt;=) via joinFoo.<br>

<br>I relate to Gábor&#39;s points that<br><br>* The familiarity advantage of (&gt;&gt;=) is a historical accident. I like to see the language improve over time, rather than accumulate accidents.<br>* I prefer functions &amp; methods with simpler interfaces over more complex interfaces. I&#39;m happy to compose these simpler operations to get more complex operations, e.g. join+fmap vs (&gt;&gt;=).<br>

<br>  - Conal<br><br><div class="gmail_quote">2011/1/6 Gábor Lehel <span dir="ltr">&lt;<a href="mailto:illissius@gmail.com">illissius@gmail.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div><div></div><div class="h5">On Thu, Jan 6, 2011 at 5:42 PM, Iavor Diatchki &lt;<a href="mailto:iavor.diatchki@gmail.com">iavor.diatchki@gmail.com</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; On Wed, Jan 5, 2011 at 3:29 PM, &lt;<a href="mailto:roconnor@theorem.ca">roconnor@theorem.ca</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Wed, 5 Jan 2011, Iavor Diatchki wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On Wed, Jan 5, 2011 at 8:04 AM, &lt;<a href="mailto:roconnor@theorem.ca">roconnor@theorem.ca</a>&gt; wrote:<br>
&gt;&gt;&gt;      On Tue, 4 Jan 2011, Iavor Diatchki wrote:<br>
&gt;&gt;&gt;      In my completion monad, &quot;join&quot; is more efficent than &quot;bind id&quot;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; This suggests that your monad will work less efficiently if you use it<br>
&gt;&gt;&gt; with the do-notation.<br>
&gt;&gt;<br>
&gt;&gt; No.  If I need to use fmap, there is no getting around it.  Only if I use<br>
&gt;&gt; &quot;bind id&quot; is it faster to use &quot;join&quot;.<br>
&gt;<br>
&gt; I am not familiar with your monad but if you are not making essential use of<br>
&gt; &quot;bind&quot; (or join and fmap together), then perhaps the monadic structure is<br>
&gt; not particularly important?<br>
&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Join and bind are very similar and, at least in standard Haskell code, I<br>
&gt;&gt;&gt; think that &quot;bind&quot; has proven to be a lot<br>
&gt;&gt;&gt; more useful then &quot;join&quot;.<br>
&gt;&gt;<br>
&gt;&gt; AFAIU, In applicative style programming &quot;join&quot; has proven to be a lot more<br>
&gt;&gt; useful than &quot;bind&quot;.<br>
&gt;<br>
&gt; I am not sure what you mean here, I find the &quot;do&quot; notation quite useful.<br>
&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Also, as I mentioned before, if people find &quot;join&quot; easier to define then<br>
&gt;&gt;&gt; &quot;bind&quot;, then they can define &quot;join&quot;, and<br>
&gt;&gt;&gt; then define &quot;bind&quot; in terms of that---I am still not convinced that we<br>
&gt;&gt;&gt; need a new method added to the Monad class.<br>
&gt;&gt;<br>
&gt;&gt; If people find &quot;bind&quot; easier to define &quot;join&quot;, then they can define<br>
&gt;&gt; &quot;bind&quot;, and then define &quot;join&quot; in terms of that---Your argument is totally<br>
&gt;&gt; symetric in the terms &quot;bind&quot; and &quot;join&quot;.<br>
&gt;<br>
&gt; The situation is not symmetric because we already have a class with &quot;&gt;&gt;=&quot;<br>
&gt; and lots of code which depends on it---so I don&#39;t think that replacing &quot;&gt;&gt;=&quot;<br>
&gt; with &quot;join&quot; is really plausible (I would certainly not support such a<br>
&gt; change).  I am not convinced that adding &quot;join&quot; to the class, in addition to<br>
&gt; &quot;&gt;&gt;=&quot;, buys us anything but complexity.<br>
&gt; -Iavor<br>
<br>
</div></div>I&#39;m not sure what you mean here by &quot;replace&quot; -- to _remove_ bind from<br>
Monad, and add join instead? I don&#39;t know of anyone proposing this.<br>
<br>
You&#39;re perfectly correct that it&#39;s possible to define a standalone<br>
join function yourself, and then write in what would be the proposed<br>
default definition for bind manually -- but roconnor is also perfectly<br>
correct that if the situation were the other way around, the same<br>
thing would be true in reverse. In other words, the argument is that<br>
the situation with bind being a method of Monad and join not being<br>
such is a historical accident, and not one supported by the merits.<br>
<br>
The fact that you can still write the function outside the class and<br>
define the class method in terms of it manually is true of<br>
approximately every class method and standalone function ever written.<br>
We could write all of our classes so that the most complicated and<br>
impressive functions are the methods, while defining the simple ones<br>
standalone in terms of those, with perhaps only a small amount of<br>
annoyance overhead resulting for our users -- but we don&#39;t. We tend to<br>
seek the ability to write minimal class definitions using the simplest<br>
and most straightforward methods we can find. It sends a message: this<br>
is the easiest/best way to write an instance. If you resort to writing<br>
what should&#39;ve been a method as a standalone function instead and<br>
defining the method in terms of it, the message it sends is &quot;the<br>
definition of this class is flawed and I&#39;m working around it&quot;. But<br>
most people probably don&#39;t think of doing this, and just define the<br>
simplest out of whatever methods they are given. After all, writing<br>
simple functions and then defining the more complex ones as<br>
combinations of those is what Haskell is all about, isn&#39;t it? So we<br>
should strive to support that, even if it can be done in our spite<br>
when we don&#39;t.<br>
<br>
And as has been argued at length in this thread, for a great many<br>
types it is easier, cognitively if not physically, to define fmap and<br>
join than to define bind. (And for the others, like Oleg&#39;s example,<br>
they can just say fmap = liftM and keep merrily on.) It was actually<br>
thinking about the type signature of join which made the whole Monad<br>
thing finally &#39;click&#39; for me, which isn&#39;t bad considering that<br>
Applicative has only about halfway clicked so far. It absolutely feels<br>
more fundamental as an operation than bind does, even if bind might be<br>
the more useful combinator.<br>
<br>
There&#39;s also the consideration that when defining instances for a new<br>
type, many (most?) people tend to write an instance for the superest<br>
class in a hierarchy first, and then to work their way down. (Even<br>
without the hierarchy being explicit a lot of people, myself included,<br>
already do this for Functor/Applicative/Monad). So by the time they<br>
get to Monad they have an fmap already written, and they&#39;re like --<br>
&quot;why do I have to reimplement essentially the same functionality again<br>
as part of (&gt;&gt;=)? Oh wait, here&#39;s join instead, that&#39;ll be easier.&quot;<br>
<div class="im"><br>
<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Libraries mailing list<br>
&gt; <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
&gt; <a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
&gt;<br>
&gt;<br>
<br>
<br>
<br>
</div><div class="im">--<br>
Work is punishment for failing to procrastinate effectively.<br>
<br>
_______________________________________________<br>
</div><div><div></div><div class="h5">Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a><br>
</div></div></blockquote></div><br>