[Haskell-beginners] wierd quickcheck outcome

Roelof Wobben r.wobben at home.nl
Thu Sep 10 12:12:44 UTC 2015


Op 10-9-2015 om 09:54 schreef Frerich Raabe:
> 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))
>


Thanks,

Learned that in this sort of situations I have to check the precendence.

Roelof



More information about the Beginners mailing list