
New patches:

[move Layout stuff into class (hokey first cut).
David Roundy <droundy@darcs.net>**20070914215959] 
<
> {
hunk ./Config.hs 95
 -- |
 -- The default set of tiling algorithms
 --
-defaultLayouts :: [Layout Window]
-defaultLayouts = [ tiled
-                 , mirror tiled
-                 , full
+defaultLayouts :: [SomeLayout Window]
+defaultLayouts = [ SomeLayout tiled
+                 , SomeLayout $ mirror tiled
+                 , SomeLayout full
 
                  -- Extension-provided layouts
                  ]
hunk ./Main.hs 58
                | otherwise = new workspaces $ zipWith SD xinesc gaps
         gaps = take (length xinesc) $ defaultGaps ++ repeat (0,0,0,0)
 
-        safeLayouts = case defaultLayouts of [] -> (full, []); (x:xs) -> (x,xs)
+        safeLayouts = case defaultLayouts of [] -> (SomeLayout full, []); (x:xs) -> (x,xs)
         cf = XConf
             { display       = dpy
             , theRoot       = rootw
hunk ./Operations.hs 141
 
         -- just the tiled windows:
         -- now tile the windows on this workspace, modified by the gap
-        (rs, ml') <- runLayout l viewrect tiled `catchX` runLayout full viewrect tiled
+        (rs, ml') <- runLayout l viewrect tiled `catchX` runLayout (SomeLayout full) viewrect tiled
         mapM_ (uncurry tileWindow) rs
         whenJust ml' $ \l' -> modify $ \ss ->
                               ss { layouts = M.adjust (first (const l')) n (layouts ss) }
hunk ./Operations.hs 354
 
 -- simple fullscreen mode, just render all windows fullscreen.
 -- a plea for tuple sections: map . (,sc)
-full :: Layout a
-full = Layout { doLayout     = \sc (W.Stack f _ _) -> return ([(f, sc)],Nothing)
-              , modifyLayout = const (return Nothing) } -- no changes
+full :: OldLayout a
+full = OldLayout { doLayout'     = \sc (W.Stack f _ _) -> return ([(f, sc)],Nothing)
+                 , modifyLayout' = const (return Nothing) } -- no changes
 
 --
 -- The tiling mode of xmonad, and its operations.
hunk ./Operations.hs 361
 --
-tall :: Int -> Rational -> Rational -> Layout a
+tall :: Int -> Rational -> Rational -> OldLayout a
 tall nmaster delta frac =
hunk ./Operations.hs 363
-    Layout { doLayout     = \r -> return . (\x->(x,Nothing)) .
+    OldLayout { doLayout' = \r -> return . (\x->(x,Nothing)) .
                                   ap zip (tile frac r nmaster . length) . W.integrate
hunk ./Operations.hs 365
-           , modifyLayout = \m -> return $ msum [fmap resize     (fromMessage m)
-                                                ,fmap incmastern (fromMessage m)] }
+              , modifyLayout' = \m -> return $ msum [fmap resize     (fromMessage m)
+                                                    ,fmap incmastern (fromMessage m)] }
 
     where resize Shrink = tall nmaster delta (max 0 $ frac-delta)
           resize Expand = tall nmaster delta (min 1 $ frac+delta)
hunk ./Operations.hs 377
 mirrorRect (Rectangle rx ry rw rh) = (Rectangle ry rx rh rw)
 
 -- | Mirror a layout, compute its 90 degree rotated form.
-mirror :: Layout a -> Layout a
-mirror (Layout { doLayout = dl, modifyLayout = ml }) =
-    Layout { doLayout     = \sc w -> do (wrs, ml') <- dl (mirrorRect sc) w
+mirror :: Layout l a => l a -> OldLayout a
+mirror l =
+    OldLayout { doLayout' = \sc w -> do (wrs, ml') <- doLayout l (mirrorRect sc) w
                                         return (map (second mirrorRect) wrs, mirror `fmap` ml')
hunk ./Operations.hs 381
-           , modifyLayout = fmap (fmap mirror) . ml }
+              , modifyLayout' = fmap (fmap mirror) . modifyLayout l }
 
 -- | tile.  Compute the positions for windows using the default 2 pane tiling algorithm.
 --
hunk ./XMonad.hs 18
 -----------------------------------------------------------------------------
 
 module XMonad (
-    X, WindowSet, WorkspaceId, ScreenId(..), ScreenDetail(..), XState(..), XConf(..), Layout(..),
+    X, WindowSet, WorkspaceId, ScreenId(..), ScreenDetail(..), XState(..), XConf(..), Layout(..), OldLayout(..), SomeLayout(..),
     Typeable, Message, SomeMessage(..), fromMessage, runLayout,
     runX, catchX, io, catchIO, withDisplay, withWindowSet, isRoot, getAtom, spawn, restart, trace, whenJust, whenX,
     atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW
hunk ./XMonad.hs 46
     { windowset    :: !WindowSet           -- ^ workspace list
     , mapped       :: !(S.Set Window)      -- ^ the Set of mapped windows
     , waitingUnmap :: !(M.Map Window Int)  -- ^ the number of expected UnmapEvents
-    , layouts      :: !(M.Map WorkspaceId (Layout Window, [Layout Window]))
+    , layouts      :: !(M.Map WorkspaceId (SomeLayout Window, [SomeLayout Window]))
                        -- ^ mapping of workspaces to descriptions of their layouts
     , dragging     :: !(Maybe (Position -> Position -> X (), X ())) }
 data XConf = XConf
hunk ./XMonad.hs 134
 -- that message and the screen is not refreshed.  Otherwise, 'modifyLayout'
 -- returns an updated 'Layout' and the screen is refreshed.
 --
-data Layout a = Layout { doLayout     :: Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (Layout a))
-                       , modifyLayout :: SomeMessage -> X (Maybe (Layout a)) }
+data OldLayout a =
+    OldLayout { doLayout'     :: Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (OldLayout a))
+              , modifyLayout' :: SomeMessage -> X (Maybe (OldLayout a)) }
 
hunk ./XMonad.hs 138
-runLayout :: Layout a -> Rectangle -> StackOrNot a -> X ([(a, Rectangle)], Maybe (Layout a))
+data SomeLayout a = forall l. Layout l a => SomeLayout (l a)
+
+class Layout layout a where
+    doLayout :: layout a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (layout a))
+    modifyLayout :: layout a -> SomeMessage -> X (Maybe (layout a))
+
+instance Layout OldLayout a where
+    doLayout = doLayout'
+    modifyLayout = modifyLayout'
+
+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')
+
+runLayout :: Layout l a => l a -> Rectangle -> StackOrNot a -> X ([(a, Rectangle)], Maybe (l a))
 runLayout l r = maybe (return ([], Nothing)) (doLayout l r)
 
 -- | Based on ideas in /An Extensible Dynamically-Typed Hierarchy of Exceptions/,
}
[eliminate ugly OldLayout.
David Roundy <droundy@darcs.net>**20070920155237] 
<
> {
hunk ./Config.hs 97
 --
 defaultLayouts :: [SomeLayout Window]
 defaultLayouts = [ SomeLayout tiled
-                 , SomeLayout $ mirror tiled
-                 , SomeLayout full
+                 , SomeLayout $ Mirror tiled
+                 , SomeLayout Full
 
                  -- Extension-provided layouts
                  ]
hunk ./Config.hs 104
   where
      -- default tiling algorithm partitions the screen into two panes
-     tiled   = tall nmaster delta ratio
+     tiled   = Tall nmaster delta ratio
 
      -- The default number of windows in the master pane
      nmaster = 1
hunk ./Main.hs 58
                | otherwise = new workspaces $ zipWith SD xinesc gaps
         gaps = take (length xinesc) $ defaultGaps ++ repeat (0,0,0,0)
 
-        safeLayouts = case defaultLayouts of [] -> (SomeLayout full, []); (x:xs) -> (x,xs)
+        safeLayouts = case defaultLayouts of [] -> (SomeLayout Full, []); (x:xs) -> (x,xs)
         cf = XConf
             { display       = dpy
             , theRoot       = rootw
hunk ./Operations.hs 141
 
         -- just the tiled windows:
         -- now tile the windows on this workspace, modified by the gap
-        (rs, ml') <- runLayout l viewrect tiled `catchX` runLayout (SomeLayout full) viewrect tiled
+        (rs, ml') <- runLayout l viewrect tiled `catchX` runLayout (SomeLayout Full) viewrect tiled
         mapM_ (uncurry tileWindow) rs
         whenJust ml' $ \l' -> modify $ \ss ->
                               ss { layouts = M.adjust (first (const l')) n (layouts ss) }
hunk ./Operations.hs 354
 
 -- simple fullscreen mode, just render all windows fullscreen.
 -- a plea for tuple sections: map . (,sc)
-full :: OldLayout a
-full = OldLayout { doLayout'     = \sc (W.Stack f _ _) -> return ([(f, sc)],Nothing)
-                 , modifyLayout' = const (return Nothing) } -- no changes
-
+data Full a = Full
+instance Layout Full a where
+    doLayout Full sc (W.Stack f _ _) = return ([(f, sc)], Nothing)
+    modifyLayout Full _ = return Nothing -- no changes
 --
 -- The tiling mode of xmonad, and its operations.
 --
hunk ./Operations.hs 361
-tall :: Int -> Rational -> Rational -> OldLayout a
-tall nmaster delta frac =
-    OldLayout { doLayout' = \r -> return . (\x->(x,Nothing)) .
-                                  ap zip (tile frac r nmaster . length) . W.integrate
-              , modifyLayout' = \m -> return $ msum [fmap resize     (fromMessage m)
-                                                    ,fmap incmastern (fromMessage m)] }
-
-    where resize Shrink = tall nmaster delta (max 0 $ frac-delta)
-          resize Expand = tall nmaster delta (min 1 $ frac+delta)
-          incmastern (IncMasterN d) = tall (max 0 (nmaster+d)) delta frac
+data Tall a = Tall Int Rational Rational
+instance Layout Tall a where
+    doLayout (Tall nmaster _ frac) r =
+        return . (\x->(x,Nothing)) .
+        ap zip (tile frac r nmaster . length) . W.integrate
+    modifyLayout (Tall nmaster delta frac) m =
+        return $ msum [fmap resize (fromMessage m)
+                      ,fmap incmastern (fromMessage m)]
+        where resize Shrink = Tall nmaster delta (max 0 $ frac-delta)
+              resize Expand = Tall nmaster delta (min 1 $ frac+delta)
+              incmastern (IncMasterN d) = Tall (max 0 (nmaster+d)) delta frac
 
 -- | Mirror a rectangle
 mirrorRect :: Rectangle -> Rectangle
hunk ./Operations.hs 378
 mirrorRect (Rectangle rx ry rw rh) = (Rectangle ry rx rh rw)
 
 -- | Mirror a layout, compute its 90 degree rotated form.
-mirror :: Layout l a => l a -> OldLayout a
-mirror l =
-    OldLayout { doLayout' = \sc w -> do (wrs, ml') <- doLayout l (mirrorRect sc) w
-                                        return (map (second mirrorRect) wrs, mirror `fmap` ml')
-              , modifyLayout' = fmap (fmap mirror) . modifyLayout l }
+data Mirror a = forall l. Layout l a => Mirror (l a)
+instance Layout Mirror a where
+    doLayout (Mirror l) r s = do (wrs, ml') <- doLayout l (mirrorRect r) s
+                                 return (map (second mirrorRect) wrs, Mirror `fmap` ml')
+    modifyLayout (Mirror l) = fmap (fmap Mirror) . modifyLayout l
 
 -- | tile.  Compute the positions for windows using the default 2 pane tiling algorithm.
 --
hunk ./XMonad.hs 18
 -----------------------------------------------------------------------------
 
 module XMonad (
-    X, WindowSet, WorkspaceId, ScreenId(..), ScreenDetail(..), XState(..), XConf(..), Layout(..), OldLayout(..), SomeLayout(..),
+    X, WindowSet, WorkspaceId, ScreenId(..), ScreenDetail(..), XState(..), XConf(..), Layout(..), SomeLayout(..),
     Typeable, Message, SomeMessage(..), fromMessage, runLayout,
     runX, catchX, io, catchIO, withDisplay, withWindowSet, isRoot, getAtom, spawn, restart, trace, whenJust, whenX,
     atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW
hunk ./XMonad.hs 134
 -- that message and the screen is not refreshed.  Otherwise, 'modifyLayout'
 -- returns an updated 'Layout' and the screen is refreshed.
 --
-data OldLayout a =
-    OldLayout { doLayout'     :: Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (OldLayout a))
-              , modifyLayout' :: SomeMessage -> X (Maybe (OldLayout a)) }
-
 data SomeLayout a = forall l. Layout l a => SomeLayout (l a)
 
 class Layout layout a where
hunk ./XMonad.hs 140
     doLayout :: layout a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (layout a))
     modifyLayout :: layout a -> SomeMessage -> X (Maybe (layout a))
 
-instance Layout OldLayout a where
-    doLayout = doLayout'
-    modifyLayout = modifyLayout'
-
 instance Layout SomeLayout a where
     doLayout (SomeLayout l) r s = do (ars, ml') <- doLayout l r s
                                      return (ars, SomeLayout `fmap` ml' )
}
[add Show instance to Layout
David Roundy <droundy@darcs.net>**20070920161208] 
<
> {
hunk ./Operations.hs 354
 
 -- simple fullscreen mode, just render all windows fullscreen.
 -- a plea for tuple sections: map . (,sc)
-data Full a = Full
+data Full a = Full deriving Show
 instance Layout Full a where
     doLayout Full sc (W.Stack f _ _) = return ([(f, sc)], Nothing)
     modifyLayout Full _ = return Nothing -- no changes
hunk ./Operations.hs 361
 --
 -- The tiling mode of xmonad, and its operations.
 --
-data Tall a = Tall Int Rational Rational
+data Tall a = Tall Int Rational Rational deriving Show
 instance Layout Tall a where
     doLayout (Tall nmaster _ frac) r =
         return . (\x->(x,Nothing)) .
hunk ./Operations.hs 379
 
 -- | Mirror a layout, compute its 90 degree rotated form.
 data Mirror a = forall l. Layout l a => Mirror (l a)
+instance Show (Mirror a) where
+    show (Mirror l) = "Mirror "++show l
 instance Layout Mirror a where
     doLayout (Mirror l) r s = do (wrs, ml') <- doLayout l (mirrorRect r) s
                                  return (map (second mirrorRect) wrs, Mirror `fmap` ml')
hunk ./XMonad.hs 135
 -- returns an updated 'Layout' and the screen is refreshed.
 --
 data SomeLayout a = forall l. Layout l a => SomeLayout (l a)
+instance Show (SomeLayout a) where
+    show (SomeLayout l) = show l
 
hunk ./XMonad.hs 138
-class Layout layout a where
+class Show (layout a) => Layout layout a where
     doLayout :: layout a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (layout a))
     modifyLayout :: layout a -> SomeMessage -> X (Maybe (layout a))
 
}
[add Read instance to Layout.
David Roundy <droundy@darcs.net>**20070920174529] 
<
> {
hunk ./Operations.hs 354
 
 -- simple fullscreen mode, just render all windows fullscreen.
 -- a plea for tuple sections: map . (,sc)
-data Full a = Full deriving Show
+data Full a = Full deriving ( Show, Read )
 instance Layout Full a where
     doLayout Full sc (W.Stack f _ _) = return ([(f, sc)], Nothing)
     modifyLayout Full _ = return Nothing -- no changes
hunk ./Operations.hs 361
 --
 -- The tiling mode of xmonad, and its operations.
 --
-data Tall a = Tall Int Rational Rational deriving Show
+data Tall a = Tall Int Rational Rational deriving ( Show, Read )
 instance Layout Tall a where
     doLayout (Tall nmaster _ frac) r =
         return . (\x->(x,Nothing)) .
hunk ./Operations.hs 378
 mirrorRect (Rectangle rx ry rw rh) = (Rectangle ry rx rh rw)
 
 -- | Mirror a layout, compute its 90 degree rotated form.
-data Mirror a = forall l. Layout l a => Mirror (l a)
-instance Show (Mirror a) where
+data Mirror l a = Layout l a => Mirror (l a)
+instance Layout l a => Show (Mirror l a) where
     show (Mirror l) = "Mirror "++show l
hunk ./Operations.hs 381
-instance Layout Mirror a where
+instance Layout l a => Read (Mirror l a) where
+    readsPrec _ s = case take (length "Mirror ") s of
+                      "Mirror " -> map (\ (l,s') -> (Mirror l,s')) $ reads $ drop (length "Mirror ") s
+                      _ -> []
+
+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')
     modifyLayout (Mirror l) = fmap (fmap Mirror) . modifyLayout l
hunk ./XMonad.hs 137
 data SomeLayout a = forall l. Layout l a => SomeLayout (l a)
 instance Show (SomeLayout a) where
     show (SomeLayout l) = show l
+instance Read (SomeLayout a) where
+    readsPrec _ _ = [] -- We can't read an existential type!!!
 
hunk ./XMonad.hs 140
-class Show (layout a) => Layout layout a where
+class (Show (layout a), Read (layout a)) => Layout layout a where
     doLayout :: layout a -> Rectangle -> Stack a -> X ([(a, Rectangle)], Maybe (layout a))
     modifyLayout :: layout a -> SomeMessage -> X (Maybe (layout a))
 
}

Context:

[fmt, and tiny comment seeking clarification
Don Stewart <dons@galois.com>**20070917234658] 
[Eliminate Operations.sink too
Spencer Janssen <sjanssen@cse.unl.edu>**20070917214052] 
[Remove Operations functions which have StackSet equivalents, just use 'windows foo' instead
Spencer Janssen <sjanssen@cse.unl.edu>**20070917211953] 
[Change manpage token @@ to %! to avoid conflicts with Haddock (xmonad)
Alex Tarkovsky <alextarkovsky@gmail.com>**20070916235229] 
[Haddockify delete' comments
Spencer Janssen <sjanssen@cse.unl.edu>**20070917194114] 
[Fix float behaviour, add shiftWin.
Karsten Schoelzel <kuser@gmx.de>**20070910090329
 
 First, if float is called with window which is on a hidden workspace,
 then the window will remain on that hidden workspace.
 
 Now the focus should change more as expected:
 float w = (view current) . (shiftWin ws w)
     where
         current is the current screen/workspace
         shiftWin ws w is: - view the workspace w is on
             - set focus on w
             - shift ws
             - set focus back to window it was on that workspace
                 unless w was focused
 
 shiftWin was add to StackSet.hs 
] 
[Add delete' for use in shift
Karsten Schoelzel <kuser@gmx.de>**20070910113835
 
 Rename delete to delete' so we can clear floating status in delete,
 thus removing one special handling. 
 At the moment delete' is only used in shift, but is useful for temporarily
 removing a window from the stack.
] 
[update description field of cabal file
Don Stewart <dons@galois.com>**20070916023016] 
[pointfree looks nicer here
Don Stewart <dons@cse.unsw.edu.au>**20070911051928] 
[Remove redundant reveal
Spencer Janssen <sjanssen@cse.unl.edu>**20070910213807] 
[Add missing insert markers for generate-configs.sh in Config.hs
Alex Tarkovsky <alextarkovsky@gmail.com>**20070907120414] 
[Move lower boundary check into applySizeHints, because all users of applySizeHints
Karsten Schoelzel <kuser@gmx.de>**20070905192125
 do this manually.
] 
[export getAtom from XMonad.
Ivan Tarasov <Ivan.Tarasov@gmail.com>**20070825174156] 
[Use show rather than string hacks
Spencer Janssen <sjanssen@cse.unl.edu>**20070905202816] 
[switch WorkspaceId to String.
David Roundy <droundy@darcs.net>**20070820113658] 
[Alex Tarkovsky's docstring patch updated for conflicts
Spencer Janssen <sjanssen@cse.unl.edu>**20070905193558] 
[tasks done
Don Stewart <dons@cse.unsw.edu.au>**20070905004901] 
[TAG 0.3
Spencer Janssen <sjanssen@cse.unl.edu>**20070904195245] 
Patch bundle hash:
735aea00f1b0ba85ca5965574f3b3cd6891af687
