
hehe, this foolish interface won't allow birdtrack code it thinks means I'm top posting. So add this.
Since the parser only runs the conversion on chars in "12345" use !! for concise clarity. Considered using 2^(n+2) or shiftL, or crazy ugly overkill like
return $ fromMaybe (modMask c) (mbMod (read [n])) where mbMod i = lookup i $ zip [1..] [mod1Mask,mod2Mask,mod3Mask,mod4Mask,mod5Mask]
... but figured this is appropriate use of the much maligned (!!). More context:
parseModifier :: XConfig l -> ReadP KeyMask parseModifier c = (string "M-" >> return (modMask c)) +++ (string "C-" >> return controlMask) +++ (string "S-" >> return shiftMask) +++ do char 'M' n <- satisfy (`elem` ['1'..'5']) char '-' return $ f n -- f converts
Also added couple of minor style changes unrelated to the Mn issue. regards, -- wmw