[Haskell-cafe] Typing problems with basic arithmetic - help!
mm3 at zepler.net
Fri Sep 23 20:20:22 EDT 2005
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)]
[ (sort (a:x)) | x <- (choosenonuniqueset n r)]
| (length r) == (n-1) = [a:r]
| (length r) < (n-1) = 
Error message is:
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]
More information about the Haskell-Cafe