Been trying to write my own Prelude, and to write QuickCheck properties along with it. Writing Prelude is going well, but in doing the QuickCheck I have managed to get blocked early. Here are snippets of the 2 files I have:
— MyLude.hs
module MyLude where
import Prelude (Bool(..))
(&&) :: Bool -> Bool -> Bool
(&&) True a = a
(&&) _ _ = False
— MyLudeTest.hs
module MyLudeTest where
import qualified MyLude as P
prop_test_and a b = a && b == a P.&& b
Then in ghci I run:
:load MyLudeTest.hs
:m +Test.QuickCheck
quickCheck prop_test_and
and get the following error:
*** Failed! Falsifiable (after 1 test):
False
False
What confuses me is that I have implemented (||) and implemented a quickcheck property for it that does pretty much the same thing the prop_test_and does, and that seems to have no problems. What am I missing?
This is just operator precedence at work. Your property is parsed as: