[Haskell-beginners] wierd quickcheck outcome

Frerich Raabe raabe at froglogic.com
Thu Sep 10 07:54:37 UTC 2015


On 2015-09-10 09:23, Roelof Wobben wrote:
> which I wants to test with this function :
> 
> prop_fourDifferent :: Integer -> Integer -> Integer -> Integer -> Bool
> prop_fourDifferent a b c d = fourDifferent a b c d == ( a == b ) && ( a == c 
> ) && (a == d)

The problem is that (==) has a higher precedence (4) than (&&) (which has 
precedence 3). So your definition is equivalent to

   prop_fourDifferent a b c d = (fourDifferent a b c d == ( a == b )) && ( a 
== c ) && (a == d)

You need some extra parentheses there, try

   prop_fourDifferent a b c d = fourDifferent a b c d == (( a == b ) && ( a == 
c ) && (a == d))

-- 
Frerich Raabe - raabe at froglogic.com
www.froglogic.com - Multi-Platform GUI Testing


More information about the Beginners mailing list