1

In the following function definition I am getting Non-exhaustive patterns in function tapChar.

What am I missing?

reverseTap :: DaPhone -> Char -> [(Digit, Presses)]
reverseTap phone s 
    | isUpper s  = ('*',1) : tapChar (toLower s) phone
    | otherwise = tapChar s phone
    where tapChar s (DaPhone[buttons]) = map (\x -> case (elemIndex s $ phChar x) of
                                         (Just i)  ->  (digit x , i)
                                         Nothing   ->  (' ', (-1))) [buttons]
          phChar (Button _ chars) = chars
          digit  (Button d _)     = d
mkrieger1
  • 19,194
  • 5
  • 54
  • 65
smuthu06
  • 39
  • 3

1 Answers1

6

[buttons] means "a list with one element, with said one element being bound to buttons", but you're using it as if it meant "a list bound to buttons". To get that, just use buttons instead.