the following code compiles well but when i try to input helper 10 primes [] [] it gives me :Non-exhaustive patterns in function helper
primes = [2, 3, 5, 7,
What you're trying to evaluate:
helper 10 primes [] []
Your equations for helper
:
helper n [] (v) _ = ...
helper n (x:y:xs) (v) (c:cs) = ...
Let's try to match the first equation:
n = 10
matches[] = primes
does not matchOK, let's try to match the second equation instead:
n = 10
matches(x:y:xs) = primes
matches, with
x = 2
y = 3
xs = [5, 7, 11, 13, ...]
v = []
matches(c:cs) = []
does not matchSo neither pattern matches. We have a pattern match failure.