use FiniteBitSize with ghc >= 7.8

This commit is contained in:
Adam Vogt
2014-08-15 05:11:36 +00:00
parent 6c410a8a00
commit 8a195a2a48

View File

@@ -225,6 +225,12 @@ clientMessages = [("_NET_ACTIVE_WINDOW",("_NET_ACTIVE_WINDOW",32,1))
,("WM_SAVE_YOURSELF" ,("STRING" , 8,0)) ,("WM_SAVE_YOURSELF" ,("STRING" , 8,0))
] ]
#if __GLASGOW_HASKELL__ < 707
finiteBitSize :: Bits a => a -> Int
finiteBitSize x = bitSize x
#endif
-- | Convert a modifier mask into a useful string -- | Convert a modifier mask into a useful string
vmask :: KeyMask -> KeyMask -> String vmask :: KeyMask -> KeyMask -> String
vmask numLockMask msk = unwords $ vmask numLockMask msk = unwords $
@@ -232,7 +238,7 @@ vmask numLockMask msk = unwords $
fst $ fst $
foldr vmask' ([],msk) masks foldr vmask' ([],msk) masks
where where
masks = map (\m -> (m,show m)) [0..toEnum (bitSize msk - 1)] ++ masks = map (\m -> (m,show m)) [0..toEnum (finiteBitSize msk - 1)] ++
[(numLockMask,"num" ) [(numLockMask,"num" )
,( lockMask,"lock" ) ,( lockMask,"lock" )
,(controlMask,"ctrl" ) ,(controlMask,"ctrl" )