Commits

Luke Plant  committed 2903b64

Allow digits in words (like R2D2)

  • Participants
  • Parent commits a395c46

Comments (0)

Files changed (1)

File phone2word.hs

 getLetters digit = fromJust $ Map.lookup digit lettersMap
 
 getNumber :: Char -> Maybe Char
-getNumber char = Map.lookup (toUpper char) numbersMap
+getNumber char =
+    if isDigit char
+    then Just char
+    else Map.lookup (toUpper char) numbersMap
 
 data WordTree = Node { nodeLabel :: Char           -- digit
                      , nodeSubForest :: [WordTree] -- children