The Fairbairn threshold is the point at which the effort of looking up or keeping track of the definition is outweighed by the effort of rederiving it or inlining it.<div><br></div><div><div>The term was in much more common use several years ago.</div>
<div><br></div><div>Adding every variant on every operation to the Prelude is certainly possible given infinite time, but this of course imposes a sort of indexing overhead mentally.<div><br></div><div>The primary use of the Fairbairn threshold is as a litmus test to avoid giving names to trivial compositions, as there are a potentially explosive number of them. In particular any method whose definition isn&#39;t much longer than its name (e.g. fooBar = foo . bar) falls below the threshold.</div>
<div><br></div><div>There are reasonable exceptions for especially common idioms, but it does provide a good rule of thumb. </div><div><br></div><div>The effect is to encourage simple combinators that can be used in multiple situations, while avoiding naming the explosive number of combinations of those combinators.</div>
<div><br></div><div>Given n combinators I can probably combine two of them in something like O(n^2) ways, so without the threshold as a rule of thumb you wind up with a much larger library, but no real greater utility and much higher cognitive overhead to track all the combinations. </div>
<div><br></div><div>Further, the existence of some combinations tends to drive you to look for other ever larger combinations rather than learn how to compose combinators or spot the more general usage patterns yourself, so from a POSIWID perspective, the threshold encourages better use of the functional programming style as well.</div>
<div><br></div><div>-Edward</div><div><br><div class="gmail_quote">On Tue, Feb 14, 2012 at 4:02 PM, Brent Yorgey <span dir="ltr">&lt;<a href="mailto:byorgey@seas.upenn.edu">byorgey@seas.upenn.edu</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, Feb 14, 2012 at 03:36:22PM -0500, Edward Kmett wrote:<br>
&gt; The biggest problem is that with each one of these being so short and with<br>
&gt; so many useful variations, the concepts struggle to cross the &quot;Fairbairn<br>
&gt; threshold&quot;.<br>
<br>
</div>What is the &quot;Fairbairn threshold&quot;?  I tried doing a Google search for<br>
it, and all I got was a bunch of messages from <a href="mailto:libraries@haskell.org">libraries@haskell.org</a><br>
(all of which only *referenced* it, without defining it).<br>
<br>
-Brent<br>
<div class="im"><br>
&gt;<br>
&gt; On Tue, Feb 14, 2012 at 10:47 AM, Jeff Shaw &lt;<a href="mailto:shawjef3@msu.edu">shawjef3@msu.edu</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; I&#39;m all for generalizations! I have a second, very similar function I<br>
&gt; &gt; think should be added, but I don&#39;t have a good name for it.<br>
&gt; &gt;<br>
&gt; &gt; maybe mzero id :: MonadPlus m =&gt; Maybe (m a) -&gt; m a<br>
&gt; &gt;<br>
&gt; &gt; Perhaps there is once again an equivalent for Alternative.<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; On 2/14/2012 10:24 AM, Edward Kmett wrote:<br>
&gt; &gt;<br>
&gt; &gt;&gt; If you are going to add one then the generalization of your<br>
&gt; &gt;&gt; generalization to Alternative might be better.<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; maybeA = maybe empty pure<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; On Feb 14, 2012, at 9:55 AM, Jeff Shaw&lt;<a href="mailto:shawjef3@msu.edu">shawjef3@msu.edu</a>&gt;  wrote:<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt;  I find myself using this function quite a lot. I believe it should be<br>
&gt; &gt;&gt;&gt; included in Data.Maybe.<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt; import Control.Monad<br>
&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;&gt; maybeTo :: (MonadPlus m) =&gt;  Maybe a -&gt;  m a<br>
&gt; &gt;&gt;&gt; maybeTo =<br>
&gt; &gt;&gt;&gt;    maybe mzero return<br>
&gt; &gt;&gt;&gt;<br>
</div>&gt; &gt;&gt;&gt; ______________________________**_________________<br>
&gt; &gt;&gt;&gt; Libraries mailing list<br>
&gt; &gt;&gt;&gt; <a href="mailto:Libraries@haskell.org">Libraries@haskell.org</a><br>
&gt; &gt;&gt;&gt; <a href="http://www.haskell.org/**mailman/listinfo/libraries" target="_blank">http://www.haskell.org/**mailman/listinfo/libraries</a>&lt;<a href="http://www.haskell.org/mailman/listinfo/libraries" target="_blank">http://www.haskell.org/mailman/listinfo/libraries</a>&gt;<br>

<div><div></div><div class="h5">&gt; &gt;&gt;&gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;<br>
<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>
<br>
<br>
_______________________________________________<br>
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></div></div></div>