aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrandon S Allbery KF8NH <allbery.b@gmail.com>2011-02-24 01:30:21 +0100
committerBrandon S Allbery KF8NH <allbery.b@gmail.com>2011-02-24 01:30:21 +0100
commit39735df206f45d77e25bfdd96a049c4e1507bf85 (patch)
tree7b1547ca929dd9024859ee376a6375e35e9abdf6
parent636ad549aa796bf7ed3b21708a1abf9d2ab98b1d (diff)
downloadxmonad-39735df206f45d77e25bfdd96a049c4e1507bf85.tar.gz
xmonad-39735df206f45d77e25bfdd96a049c4e1507bf85.tar.xz
xmonad-39735df206f45d77e25bfdd96a049c4e1507bf85.zip
Generalize types of ManageHook functions, so they can be reused
Ignore-this: 2328f5a2ca705279ba8ae1fe4decd03e darcs-hash:20110224003021-8238f-5f37da8419ee25376f6c48da67b2ae781e89f4dd.gz
-rw-r--r--XMonad/ManageHook.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/XMonad/ManageHook.hs b/XMonad/ManageHook.hs
index 945e40b..b96933e 100644
--- a/XMonad/ManageHook.hs
+++ b/XMonad/ManageHook.hs
@@ -34,22 +34,23 @@ liftX :: X a -> Query a
liftX = Query . lift
-- | The identity hook that returns the WindowSet unchanged.
-idHook :: ManageHook
-idHook = doF id
+idHook :: Monoid m => m
+idHook = mempty
-- | Infix 'mappend'. Compose two 'ManageHook' from right to left.
(<+>) :: Monoid m => m -> m -> m
(<+>) = mappend
-- | Compose the list of 'ManageHook's.
-composeAll :: [ManageHook] -> ManageHook
+composeAll :: Monoid m => [m] -> m
composeAll = mconcat
infix 0 -->
-- | @p --> x@. If @p@ returns 'True', execute the 'ManageHook'.
-(-->) :: Query Bool -> ManageHook -> ManageHook
-p --> f = p >>= \b -> if b then f else mempty
+-- (-->) :: Monoid m => Query Bool -> Query m -> Query m
+(-->) :: (Monad m, Monoid a) => m Bool -> m a -> m a
+p --> f = p >>= \b -> if b then f else return mempty
-- | @q =? x@. if the result of @q@ equals @x@, return 'True'.
(=?) :: Eq a => Query a -> a -> Query Bool
@@ -101,7 +102,7 @@ getStringProperty d w p = do
return $ fmap (map (toEnum . fromIntegral)) md
-- | Modify the 'WindowSet' with a pure function.
-doF :: (WindowSet -> WindowSet) -> ManageHook
+doF :: (s -> s) -> Query (Endo s)
doF = return . Endo
-- | Move the window to the floating layer.