<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><font face="Courier" class=""><span style="font-size: 14px;" class="">I’m totally aware of the existence of bool, i suppose (?) is mainly used in fully application to get a different style than if-then-else syntax, say,</span></font></div><div class=""><font face="Courier" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Courier" class=""><span style="font-size: 14px;" class="">...</span></font></div><div class=""><font face="Courier" class=""><span style="font-size: 14px;" class=""> isGoo <- checkGoo</span></font></div><div class=""><font face="Courier" class=""><span style="font-size: 14px;" class=""> isGoo ? goo</span></font></div><div class=""><font face="Courier" class=""><span style="font-size: 14px;" class=""> $ woo</span></font></div><div class=""><font face="Courier" class=""><span style="font-size: 14px;" class="">...</span></font></div><div class=""><font face="Courier" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Courier" class=""><span style="font-size: 14px;" class=""><br class=""></span></font></div><div class=""><font face="Courier" class=""><span style="font-size: 14px;" class="">But like what the wiki suggested, (?) can be used in some high-order situations. I like this operator because the mnemonic of questioning meaning.</span></font></div><div class=""><br class=""></div><div class=""><br class=""></div><br class=""><div><blockquote type="cite" class=""><div class="">On 17 Nov 2016, at 11:03, David Feuer <<a href="mailto:david.feuer@gmail.com" class="">david.feuer@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><p dir="ltr" class="">If ifThenElse is good for RebindableSyntax, then I'm +1 on that (but I've never played with that extension, so I don't really know). I'm -1 on (?). We already have bool, which tends to be rather more useful when partially applied.</p>
<div class="gmail_extra"><br class=""><div class="gmail_quote">On Nov 16, 2016 9:43 PM, "winter" <<a href="mailto:drkoster@qq.com" class="">drkoster@qq.com</a>> wrote:<br type="attribution" class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div dir="ltr" class="m_-8486897005054858839mw-content-ltr m_-8486897005054858839mw-geshi"><div class="m_-8486897005054858839source-haskell m_-8486897005054858839haskell"><pre class="m_-8486897005054858839de1">It seems this’s a very old request, see <a href="https://wiki.haskell.org/If-then-else" target="_blank" class="">https://wiki.haskell.org/If-<wbr class="">then-else</a>. I’d like to see following:</pre><pre class="m_-8486897005054858839de1"><br class=""></pre><pre class="m_-8486897005054858839de1"><span class="m_-8486897005054858839st0">ifThenElse :: Bool -> a -> a -> a
ifThenElse</span> True x <span class="m_-8486897005054858839sy0">_</span> <span class="m_-8486897005054858839sy0">=</span> x
<span class="m_-8486897005054858839st0">ifThenElse False _ y = y</span></pre></div></div><div class=""><br class=""></div><div class=""><div dir="ltr" class="m_-8486897005054858839mw-content-ltr m_-8486897005054858839mw-geshi"><div class="m_-8486897005054858839source-haskell m_-8486897005054858839haskell"><pre class="m_-8486897005054858839de1"><span class="m_-8486897005054858839kw1">infixr</span> <span class="m_-8486897005054858839nu0">1</span> <span class="m_-8486897005054858839sy0">?</span>
<span class="m_-8486897005054858839br0">(</span><span class="m_-8486897005054858839sy0">?</span><span class="m_-8486897005054858839br0">)</span> <span class="m_-8486897005054858839sy0">::</span> <span class="m_-8486897005054858839kw4">Bool</span> <span class="m_-8486897005054858839sy0">-></span> a <span class="m_-8486897005054858839sy0">-></span> a <span class="m_-8486897005054858839sy0">-></span> a
<span class="m_-8486897005054858839br0">(</span><span class="m_-8486897005054858839sy0">?</span><span class="m_-8486897005054858839br0">)</span> <span class="m_-8486897005054858839sy0">=</span> ifThenElse</pre><div class=""><br class=""></div></div></div><div class=""><pre class="m_-8486897005054858839de1"><span class="m_-8486897005054858839kw1">in Date.Bool module, it will have advantages that:</span></pre><pre class="m_-8486897005054858839de1"><span class="m_-8486897005054858839kw1"><br class=""></span></pre><pre class="m_-8486897005054858839de1"><span class="m_-8486897005054858839kw1">+ It’s more composable than syntax. </span></pre><pre class="m_-8486897005054858839de1"><span class="m_-8486897005054858839kw1">+ Write (xxx ? yyy $ zzz) instead of (if xxx then yyy else zzz) is more consistent with (f . g $ x) style, and save key strokes.</span></pre><pre class="m_-8486897005054858839de1"><span class="m_-8486897005054858839kw1">+ In module with RebindableSyntax enabled, you can import </span>ifThenElse to get default behavior.</pre><pre class="m_-8486897005054858839de1"><br class=""></pre><pre class="m_-8486897005054858839de1">Whether or not to be exported by Prelude is another question, but Data.Bool seems a good place to start with.</pre><pre class="m_-8486897005054858839de1"><br class=""></pre><pre class="m_-8486897005054858839de1">Cheers~</pre><pre class="m_-8486897005054858839de1">Winter</pre></div></div></div><br class="">______________________________<wbr class="">_________________<br class="">
Libraries mailing list<br class="">
<a href="mailto:Libraries@haskell.org" class="">Libraries@haskell.org</a><br class="">
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries" rel="noreferrer" target="_blank" class="">http://mail.haskell.org/cgi-<wbr class="">bin/mailman/listinfo/libraries</a><br class="">
<br class=""></blockquote></div></div>
</div></blockquote></div><br class=""></body></html>