<br><br><div class="gmail_quote">On 26 March 2012 21:11, Jeff Shaw <span dir="ltr"><<a href="mailto:shawjef3@msu.edu">shawjef3@msu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
can :: (MonadPlus m) => (a -> m b) -> a -> Bool<br>
can f x = case f x of<br>
mzero -> False<br>
_ -> True<br>
<br>
<br>
I got a warning:<br>
<br>
__testError.hs:31:11:<br>
Warning: Pattern match(es) are overlapped<br>
In a case alternative: _ -> ...<br>
Ok, modules loaded: Main.<br>
</blockquote></div>
The problem here is that when you match on "f x", your first match is an identifier that matches anything at all, and binds it to mzero. I think what you're looking for is<div class="im"><br>
<br>
can f x = case f x of<br></div>
x' | x' == mzero -> False<br>
_ -> True<br></blockquote></div><br><span style="font-family:courier new,monospace">can f x = f x /= mzero</span><br>