Im trying to write a function that takes in list of Cards and gives me back all the rank values. Im getting the problem of Non-exhaustive patterns in function and I can't fix it
data Card = Card Suit Rank
deriving (Show, Bounded, Read)
data Suit = Red
| Black
deriving (Show, Enum, Bounded, Read)
data Rank = Ace
| Two
| Three
| Four
| Five
| Six
| Seven
| Eight
| Nine
| Ten
deriving (Show, Enum, Bounded, Read)
handValue :: [Card] -> [Int]
handValue [Card s r]
| (length [Card s r]) < 0 = (fromEnum (r) + 1) : handValue (tail [Card s r])
| otherwise = []
What Can I do to counter this problem?