I'm trying to write a function which behave like this:
correctCards :: [Card] -> [Card] -> Int
It takes two lists of type Card and check for how many cards are the same. Here is my code:
correctCards answer guess = foldr step acc guess
where
acc = 0
step acc guess
| elem (head guess) answer = acc + 1
| otherwise = acc
But the types are not match. Can someone tell me where I went wrong? Thanks.