Browse Source

GenerateManpage: fix compiler warnings

master
Peter Simons 10 months ago
parent
commit
ec97d83f3f
1 changed files with 8 additions and 4 deletions
  1. 8
    4
      util/GenerateManpage.hs

+ 8
- 4
util/GenerateManpage.hs View File

@@ -8,7 +8,6 @@
8 8
 -- Unlike the rest of xmonad, this file is released under the GNU General
9 9
 -- Public License version 2 or later.
10 10
 
11
-import Control.Monad
12 11
 import Control.Monad.IO.Class (liftIO)
13 12
 import Data.Char
14 13
 import Data.List
@@ -71,11 +70,16 @@ allBindings xs = map (binding . map trim) (xs =~ "(.*)--(.*)%!(.*)")
71 70
 binding :: [String] -> (String, String)
72 71
 binding [ _, bindingLine, "", desc ] = (guessKeys bindingLine, desc)
73 72
 binding [ _, _, keyCombo, desc ] = (keyCombo, desc)
73
+binding x = error ("binding: called with unexpected argument " ++ show x)
74 74
 
75 75
 guessKeys :: String -> String
76
-guessKeys line = concat $ intersperse "-" (modifiers ++ [map toLower key])
77
-    where modifiers = map (!!1) (line =~ "(mod|shift|control)Mask")
78
-          (_, _, _, [key]) = line =~ "xK_([_[:alnum:]]+)" :: (String, String, String, [String])
76
+guessKeys line =
77
+  case keys of
78
+    [key] -> concat $ intersperse "-" (modifiers ++ [map toLower key])
79
+    _     -> error ("guessKeys: unexpected number of keys " ++ show keys)
80
+  where
81
+    modifiers = map (!!1) (line =~ "(mod|shift|control)Mask")
82
+    (_, _, _, keys) = line =~ "xK_([_[:alnum:]]+)" :: (String, String, String, [String])
79 83
 
80 84
 -- FIXME: What escaping should we be doing on these strings?
81 85
 markdownDefn :: (String, String) -> String

Loading…
Cancel
Save