<div dir="ltr"><font face="arial, sans-serif" color="#000000">Browsing some docos for a completely other purpose, I came across this code:</font><div><font face="arial, sans-serif" color="#000000"><br></font></div><div><font face="arial, sans-serif" color="#000000">>    <span class="gmail-nf" style="font-size:12px;box-sizing:border-box">f'</span><span style="font-size:12px"> </span><span class="gmail-p" style="font-size:12px;box-sizing:border-box">[</span><span class="gmail-n" style="font-size:12px;box-sizing:border-box">x</span><span class="gmail-p" style="font-size:12px;box-sizing:border-box">,</span><span style="font-size:12px"> </span><span class="gmail-n" style="font-size:12px;box-sizing:border-box">y</span><span class="gmail-p" style="font-size:12px;box-sizing:border-box">]</span><span style="font-size:12px"> </span><span class="gmail-o" style="font-size:12px;box-sizing:border-box">|</span><span style="font-size:12px"> </span><span class="gmail-kt" style="font-size:12px;box-sizing:border-box">True</span><span style="font-size:12px"> </span><span class="gmail-ow" style="font-size:12px;box-sizing:border-box"><-</span><span style="font-size:12px"> </span><span class="gmail-n" style="font-size:12px;box-sizing:border-box">x</span><span class="gmail-p" style="font-size:12px;box-sizing:border-box">,</span><span style="font-size:12px"> </span><span class="gmail-kt" style="font-size:12px;box-sizing:border-box">True</span><span style="font-size:12px"> </span><span class="gmail-ow" style="font-size:12px;box-sizing:border-box"><-</span><span style="font-size:12px"> </span><span class="gmail-n" style="font-size:12px;box-sizing:border-box">y</span><span style="font-size:12px"> </span><span class="gmail-ow" style="font-size:12px;box-sizing:border-box">=</span><span style="font-size:12px"> </span><span class="gmail-kt" style="font-size:12px;box-sizing:border-box">True</span></font></div><div><font face="arial, sans-serif" color="#000000"><span class="gmail-nf" style="font-size:12px;box-sizing:border-box">>    f'</span><span style="font-size:12px"> </span><span class="gmail-kr" style="font-size:12px;box-sizing:border-box">_</span><span style="font-size:12px">                              </span><span class="gmail-ow" style="font-size:12px;box-sizing:border-box">=</span><span style="font-size:12px"> </span><span class="gmail-kt" style="font-size:12px;box-sizing:border-box">False</span></font></div><div><span style="font-size:12px"><font face="arial, sans-serif" color="#000000"><br></font></span></div><div><span style="font-size:12px"><font face="arial, sans-serif" color="#000000">(In User Guide 6.7.4.5 Matching of Pattern Synonyms.)</font></span></div><div><span style="font-size:12px"><font face="arial, sans-serif" color="#000000"><br></font></span></div><div><span style="font-size:12px"><font face="arial, sans-serif" color="#000000">That business with the comma and left-arrows? They're 'Pattern guards', Language Report 2010 section 3.13. That also specs 'local bindings' introduced by `let`.</font></span></div><div><span style="font-size:12px"><font face="arial, sans-serif" color="#000000"><br></font></span></div><div><span style="font-size:12px"><font face="arial, sans-serif" color="#000000">In 10 years of reading Haskell code, I've never seen them. Does anybody use them? Are they more ergonomic than guards as plain Boolean expressions? Are 'local bindings' any different vs shunting the `let` to the rhs of the `=`?</font></span></div><div><span style="font-size:12px"><font face="arial, sans-serif" color="#000000"><br></font></span></div><div><span style="font-size:12px"><font face="arial, sans-serif" color="#000000">I'd write that code as:</font></span></div><div><span style="font-size:12px"><font face="arial, sans-serif" color="#000000"><br></font></span></div><div><div><font face="arial, sans-serif" color="#000000">>    <span class="gmail-nf" style="font-size:12px;box-sizing:border-box">f''</span><span style="font-size:12px"> </span><span class="gmail-p" style="font-size:12px;box-sizing:border-box">[</span><span class="gmail-n" style="font-size:12px;box-sizing:border-box">x@True</span><span class="gmail-p" style="font-size:12px;box-sizing:border-box">,</span><span style="font-size:12px"> </span><span class="gmail-n" style="font-size:12px;box-sizing:border-box">y@True</span><span class="gmail-p" style="font-size:12px;box-sizing:border-box">]</span><span style="font-size:12px"> </span><span style="font-size:12px"> </span><span class="gmail-ow" style="font-size:12px;box-sizing:border-box">=</span><span style="font-size:12px"> </span><span class="gmail-kt" style="font-size:12px;box-sizing:border-box">True</span></font></div><div><font face="arial, sans-serif" color="#000000"><span class="gmail-nf" style="font-size:12px;box-sizing:border-box">>    f''</span><span style="font-size:12px"> </span><span class="gmail-kr" style="font-size:12px;box-sizing:border-box">_</span><span style="font-size:12px"> </span><span class="gmail-ow" style="font-size:12px;box-sizing:border-box">=</span><span style="font-size:12px"> </span><span class="gmail-kt" style="font-size:12px;box-sizing:border-box">False</span></font></div></div><div><span style="font-size:12px"><font face="arial, sans-serif" color="#000000"><br></font></span></div><div><span style="font-size:12px"><font face="arial, sans-serif" color="#000000">I can see the rhs of the matching arrow could in general be a more complex expression. But to express that you could put a more complex Boolean guard(?)</font></span></div><div><span style="font-size:12px"><font face="arial, sans-serif" color="#000000"><br></font></span></div><div><span style="font-size:12px"><font face="arial, sans-serif" style="" color="#000000">AntC</font></span></div></div>