<div dir="ltr">><div>> <span style="color:rgb(0,0,0);white-space:pre-wrap">So your code is essentially pattern matching on a list to decide ..., then pattern matching on the Bool to split between two cases, then pattern matching on the list again. If you had kept the result of the first pattern match there would be no need for the latter two.</span><div><font color="#000000"><span style="white-space:pre-wrap">></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">> </span></font><span style="color:rgb(0,0,0);white-space:pre-wrap">Essentially the problem is "boolean blindness" ...</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">></span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">> </span><span style="color:rgb(0,0,0);white-space:pre-wrap">This style of coding is generally more readable, maintainable, and less error-prone. ...</span></div><div><span style="color:rgb(0,0,0);white-space:pre-wrap">></span></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">+1 to Ben's wise advice. +1 to "more readable". Haskell is a 'functional language' does not mean everything everywhere has to be expressed only through functions.</span></font></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">Perhaps we should promote 'Algebraic data types' (yay mathy!) and 'pattern matching' right up front on the 'Features' section of Haskell.org?</span></font></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap"><br></span></font></div><div><font color="#000000"><span style="white-space:pre-wrap">AntC<br></span></font><br class="gmail-Apple-interchange-newline"></div></div></div>