diff options
author | Don Stewart <dons@cse.unsw.edu.au> | 2007-03-07 07:15:32 +0100 |
---|---|---|
committer | Don Stewart <dons@cse.unsw.edu.au> | 2007-03-07 07:15:32 +0100 |
commit | 05e26cbe48377fc5038915130c9966e5b1b359b0 (patch) | |
tree | 3343ef8366fd50a9a152ce21c0753706f09ea3c9 /W.hs | |
parent | ded2b911ee97e02f4c1872bccb889f98ada7200f (diff) | |
download | xmonad-05e26cbe48377fc5038915130c9966e5b1b359b0.tar.gz xmonad-05e26cbe48377fc5038915130c9966e5b1b359b0.tar.xz xmonad-05e26cbe48377fc5038915130c9966e5b1b359b0.zip |
derive MonadState, removes most accessors
darcs-hash:20070307061532-9c5c1-9a125c44f0e63442f53f2d7cd9609a419cbb2c1d.gz
Diffstat (limited to 'W.hs')
-rw-r--r-- | W.hs | 26 |
1 files changed, 3 insertions, 23 deletions
@@ -34,7 +34,7 @@ type Windows = [Window] -- | The W monad, a StateT transformer over IO encapuslating the window -- manager state newtype W a = W { unW :: StateT WState IO a } - deriving (Functor, Monad, MonadIO) + deriving (Functor, Monad, MonadIO, MonadState WState) -- | Run the W monad, given a chunk of W monad code, and an initial state -- Return the result, and final state @@ -59,29 +59,9 @@ trace msg = io $ do -- --------------------------------------------------------------------- -- Getting at the window manager state --- | Return the current dispaly -getDisplay :: W Display -getDisplay = W (gets display) - --- | Return the current windows -getWindows :: W Windows -getWindows = W (gets windows) - --- | Return the screen width -getScreenWidth :: W Int -getScreenWidth = W (gets screenWidth) - --- | Return the screen height -getScreenHeight :: W Int -getScreenHeight = W (gets screenHeight) - --- | Set the current window list -setWindows ::Windows -> W () -setWindows x = W (modify (\s -> s {windows = x})) - -- | Modify the current window list -modifyWindows :: (Windows -> Windows) -> W () -modifyWindows f = W (modify (\s -> s {windows = f (windows s)})) +modifyWindows :: (Windows -> Windows) -> W () +modifyWindows f = modify $ \s -> s {windows = f (windows s)} -- --------------------------------------------------------------------- -- Generic utilities |