We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ex. 2
instance Arbitrary a => Arbitrary (Set a) where arbitrary = fmap Set arbitrary
Is wrong because the array belonging to
{-- START OF LECTURE CODE --} {-- Sets implemented as ordered lists without duplicates --} newtype Set a = Set [a] deriving (Eq,Ord)
must have no duplicates and must be ordered. A solution is:
instance (Eq a, Ord a, Arbitrary a) => Arbitrary (Set a) where arbitrary = fmap Set (liftM (sort.nub) arbitrary)
Ex. 3 Then you don't need to define 'testIntIntersection' and 'quickCheck' on a list of Integers but instead directly
quickCheckIntersection = verboseCheck (testIntersection::(Set Int->Set Int->Bool))
and so on.
Ex 7
isTransitive :: Eq a => Rel a -> Bool isTransitive xs = and [ elem(a,c) xs | (a,b) <- xs, (c,d) <- xs, b == c ]
is wrong. Must become
isTransitive :: Eq a => Rel a -> Bool isTransitive xs = and [ elem(a,d) xs | (a,b) <- xs, (c,d) <- xs, b == c ]
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Ex. 2
Is wrong because the array belonging to
must have no duplicates and must be ordered.
A solution is:
Ex. 3
Then you don't need to define 'testIntIntersection' and 'quickCheck' on a list of Integers
but instead directly
and so on.
Ex 7
is wrong. Must become
The text was updated successfully, but these errors were encountered: