
For some reason the following code is producing an error message from ghci that the the patterns are non-exhaustive. Does anyone have any idea why that could be, given that the patterns are, at least in my meaning, provably exhaustive? choosenonuniqueset n (a:r) | (length r) > (n-1) = [ (sort (a:x)) | x <- (choosenonuniqueset (n-1) r)] `union` [ (sort (a:x)) | x <- (choosenonuniqueset n r)] | (length r) == (n-1) = [a:r] | (length r) < (n-1) = [] Error message is: *Main> :reload Compiling Main ( birthday.hs, interpreted ) Ok, modules loaded: Main. *Main> choosenonuniqueset 2 [1..5] *** Exception: birthday.hs:(22,0)-(27,29): Non-exhaustive patterns in function choosenonuniqueset *Main> choosenonuniqueset 5 [1..5] [[1,2,3,4,5]] *Main>