<div dir="ltr"><div><div>+1 for bool<br><br></div>+1/2 for cond but with its signature generalized to Applicative:<br><br>&gt; cond :: Applicative f =&gt; f a -&gt; f a -&gt; f Bool -&gt; f a<br>&gt; cond = liftA3 bool<br>

<br></div>-- Conal<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Sep 10, 2013 at 5:17 PM, Dan Burton <span dir="ltr">&lt;<a href="mailto:danburton.email@gmail.com" target="_blank">danburton.email@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"><div dir="ltr"><div>+1 for Data.Bool.bool :: a -&gt; a -&gt; Bool -&gt; a. It doesn&#39;t seem very important but it does add symmetry with maybe and either, and is mostly harmless residing in Data.Bool as long as it is not re-exported by Prelude.</div>



<div><br></div>On a tangent... as usual, the Applicative instance of (a -&gt;) comes in handy for pointless programming:<div><div><br></div><div>    cond = liftA3 bool :: (a -&gt; b) -&gt; (a -&gt; b) -&gt; (a -&gt; Bool) -&gt; a -&gt; b</div>

<span class="HOEnZb"><font color="#888888">

</font></span></div><span class="HOEnZb"><font color="#888888"><div><br></div></font></span></div><div class="gmail_extra"><span class="HOEnZb"><font color="#888888"><br clear="all"><div>-- Dan Burton</div></font></span><div>

<div class="h5">
<br><br><div class="gmail_quote">On Tue, Sep 10, 2013 at 4:01 PM, Christopher Done <span dir="ltr">&lt;<a href="mailto:chrisdone@gmail.com" target="_blank">chrisdone@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">



<div dir="ltr">FWIW I&#39;ve added this to data-extra <a href="http://chrisdone.com/data-extra/Data-Bool-Extra.html" target="_blank">http://chrisdone.com/data-extra/Data-Bool-Extra.html</a> for the meanwhile.<br></div><div class="gmail_extra">





<br><br><div class="gmail_quote"><div><div>On 11 September 2013 00:02, Oliver Charles <span dir="ltr">&lt;<a href="mailto:ollie@ocharles.org.uk" target="_blank">ollie@ocharles.org.uk</a>&gt;</span> wrote:<br></div>

</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div>

Hello,<br>
<br>
I would like to propose that the following is added to Data.Bool in base:<br>
<br>
bool :: a -&gt; a -&gt; Bool -&gt; a<br>
bool f _ False = f<br>
bool _ t True  = t<br>
<br>
(Aka, bool f t b = if b then t else f)<br>
<br>
The purpose of this is hopefully evident from its definition. I find<br>
myself reaching for this in cases similar to where I would use &#39;maybe&#39; -<br>
often when I&#39;m working with &#39;fmap&#39; and don&#39;t want to start introducing<br>
names for the function I am using to map over some functor.<br>
<br>
I suggested this in #haskell and other people also seem frustrated this<br>
doesn&#39;t exist, and would like to see it happen - hopefully they will<br>
voice their support as a reply here.<br>
<br>
A quick search on FPComplete&#39;s Hoogle [1] shows five equivalent<br>
functions on the first page - and I&#39;m sure there are more on subsequent<br>
pages.<br>
<br>
Thoughts?<br>
- ocharles<br>
<br>
---<br>
[1]:<br>
<a href="https://www.fpcomplete.com/hoogle?q=Bool+-%3E+a+-%3E+a+-%3E+a&amp;env=ghc-7.4.2-stable-13.09" target="_blank">https://www.fpcomplete.com/hoogle?q=Bool+-%3E+a+-%3E+a+-%3E+a&amp;env=ghc-7.4.2-stable-13.09</a><br>
<br>
<br></div></div><div>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">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>
<br></div></blockquote></div><br></div>
<br>_______________________________________________<br>
Libraries mailing list<br>
<a href="mailto:Libraries@haskell.org" target="_blank">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>
<br></blockquote></div><br></div></div></div>
<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>
<br></blockquote></div><br></div>