<div dir="ltr"><div><div>Hi Roelof,<br></div><div><br>> False == True && False<br>False<br><br>> False == (True && False)<br>True<br><br>> :info (==)<br>class Eq a where<br> (==) :: a -> a -> Bool<br>infix 4 ==<br><br>> :info (&&)<br>(&&) :: Bool -> Bool -> Bool<br>infixr 3 &&<br><br></div>So (==) at level 4 binds tighter than (&&) at level 3.<br><br></div>See: <a href="https://www.haskell.org/onlinereport/decls.html#fixity">https://www.haskell.org/onlinereport/decls.html#fixity</a><br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">-- Kim-Ee</div></div>
<br><div class="gmail_quote">On Thu, Sep 10, 2015 at 2:23 PM, Roelof Wobben <span dir="ltr"><<a href="mailto:r.wobben@home.nl" target="_blank">r.wobben@home.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I have this function :<br>
<br>
fourDifferent:: Integer -> Integer -> Integer -> Integer -> Bool<br>
fourDifferent a b c d = ( a == b ) && ( a == c ) && (a == d)<br>
<br>
which I wants to test with this function :<br>
<br>
prop_fourDifferent :: Integer -> Integer -> Integer -> Integer -> Bool<br>
prop_fourDifferent a b c d = fourDifferent a b c d == ( a == b ) && ( a == c ) && (a == d)<br>
<br>
so I do quickCheck propFourDifferent and see this outcome :<br>
<br>
*Solution> quickCheck prop_fourDifferent<br>
*** Failed! Falsifiable (after 2 tests and 2 shrinks):<br>
0<br>
0<br>
0<br>
1<br>
<br>
*Solution> fourDifferent 0 0 0 1<br>
False<br>
*Solution> let a = 0<br>
*Solution> let b = 0<br>
*Solution> let c = 0<br>
*Solution> let d = 1<br>
*Solution> (a == b) && ( a == c) && ( a == d ) False<br>
*Solution><br>
<br>
<br>
So why is it failing. both gives false ,<br>
<br>
Roelof<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div><br></div>