summaryrefslogtreecommitdiffstats
path: root/XMonad
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
commit702686e5dadd21290c3213477dab5ff9c041891f (patch)
tree7b1547ca929dd9024859ee376a6375e35e9abdf6 /XMonad
parenta88d403e551964c08c3221d995e6bc6037bec965 (diff)
downloadmetatile-702686e5dadd21290c3213477dab5ff9c041891f.tar
metatile-702686e5dadd21290c3213477dab5ff9c041891f.zip
Generalize types of ManageHook functions, so they can be reused
Ignore-this: 2328f5a2ca705279ba8ae1fe4decd03e darcs-hash:20110224003021-8238f-5f37da8419ee25376f6c48da67b2ae781e89f4dd
Diffstat (limited to 'XMonad')
-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.