<p>To clarify, by hack I meant that it seemed like a workaround specifically to keep &quot;case&quot; in the OP&#39;s code, when it seemed like they were looking for the functionality of guards.</p>
<p>amindfv / Tom</p>
<div class="gmail_quote">On Dec 11, 2011 1:39 PM, &quot;Yitzchak Gale&quot; &lt;<a href="mailto:gale@sefer.org">gale@sefer.org</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Brandon Allbery wrote:<br>
&gt;&gt;&gt; &gt; case () of<br>
&gt;&gt;&gt; &gt;   () | s == reverse s -&gt; putStrLn &quot;palindrome&quot;<br>
&gt;&gt;&gt; &gt;   _                   -&gt; putStrLn &quot;nope&quot;<br>
<br>
Tom Murphy wrote:<br>
&gt;&gt; This is kind of a hack of case, though. I think what the OP was looking<br>
&gt;&gt; for is<br>
&gt;&gt;  isPalindrome word<br>
&gt;&gt;   | (word == reverse word) = putStrLn (word ++ &quot; is a palindrome&quot;)<br>
&gt;&gt;   | otherwise              = putStrLn (word ++ &quot; is not a palindrome&quot;)<br>
<br>
&gt; Erm?  It&#39;s as much of a hack of case as yours is, since the above is<br>
&gt; actually using case.<br>
<br>
I agree with Tom here. While it&#39;s true that the compiler<br>
internally desugars to case, that low-level compiler<br>
transformation doesn&#39;t have much to do with the<br>
best way to write clear code.<br>
<br>
I find that case often creates code that is more<br>
confusing and bug-prone. Except when what I<br>
really want to express is pattern matching, *and*<br>
there is some specific reason here why I don&#39;t<br>
want to use a named function in a let or where<br>
binding. Altogether, it doesn&#39;t come up very often<br>
for me.<br>
<br>
And even for styles that use case more than I<br>
do, certainly there is room to call the use of<br>
the &quot;case ()&quot; idiom a hack. (Even though I&#39;ll<br>
admit that I do use it sometimes.)<br>
<br>
Regards,<br>
Yitz<br>
</blockquote></div>