summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSpencer Janssen <sjanssen@cse.unl.edu>2007-09-20 23:10:42 +0200
committerSpencer Janssen <sjanssen@cse.unl.edu>2007-09-20 23:10:42 +0200
commitda36e8cb3d710fbbea06f0c8e7c92762303cc062 (patch)
tree28a61ba6e0b89da3e7d32d937dcee4cf9f2bfe6a
parentc3641121d9fd1d091882002a908f0661221b39b2 (diff)
downloadmetatile-da36e8cb3d710fbbea06f0c8e7c92762303cc062.tar
metatile-da36e8cb3d710fbbea06f0c8e7c92762303cc062.zip
Pointfree Mirror and SomeLayout instances
darcs-hash:20070920211042-a5988-0fcfdaa8b1ecfffe0f1ec5e5584d53d7e31416d7
-rw-r--r--Operations.hs4
-rw-r--r--XMonad.hs6
2 files changed, 4 insertions, 6 deletions
diff --git a/Operations.hs b/Operations.hs
index d18bd99..cedc93a 100644
--- a/Operations.hs
+++ b/Operations.hs
@@ -378,8 +378,8 @@ mirrorRect (Rectangle rx ry rw rh) = (Rectangle ry rx rh rw)
data Mirror l a = Mirror (l a) deriving (Show, Read)
instance Layout l a => Layout (Mirror l) a where
- doLayout (Mirror l) r s = do (wrs, ml') <- doLayout l (mirrorRect r) s
- return (map (second mirrorRect) wrs, Mirror `fmap` ml')
+ doLayout (Mirror l) r s = (map (second mirrorRect) *** fmap Mirror)
+ `fmap` doLayout l (mirrorRect r) s
modifyLayout (Mirror l) = fmap (fmap Mirror) . modifyLayout l
-- | tile. Compute the positions for windows using the default 2 pane tiling algorithm.
diff --git a/XMonad.hs b/XMonad.hs
index e611c31..103639e 100644
--- a/XMonad.hs
+++ b/XMonad.hs
@@ -148,10 +148,8 @@ class (Show (layout a), Read (layout a)) => Layout layout a where
modifyLayout :: layout a -> SomeMessage -> X (Maybe (layout a))
instance Layout SomeLayout a where
- doLayout (SomeLayout l) r s = do (ars, ml') <- doLayout l r s
- return (ars, SomeLayout `fmap` ml' )
- modifyLayout (SomeLayout l) m = do ml' <- modifyLayout l m
- return (SomeLayout `fmap` ml')
+ doLayout (SomeLayout l) r s = fmap (fmap $ fmap SomeLayout) $ doLayout l r s
+ modifyLayout (SomeLayout l) = fmap (fmap SomeLayout) . modifyLayout l
runLayout :: Layout l a => l a -> Rectangle -> StackOrNot a -> X ([(a, Rectangle)], Maybe (l a))
runLayout l r = maybe (return ([], Nothing)) (doLayout l r)