<div dir="ltr">FWIW I&#39;ve added this to data-extra <a href="http://chrisdone.com/data-extra/Data-Bool-Extra.html">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">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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

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>_______________________________________________<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>