summaryrefslogtreecommitdiffstats
path: root/WMonad.hs
diff options
context:
space:
mode:
authorDon Stewart <dons@cse.unsw.edu.au>2007-03-09 07:01:39 +0100
committerDon Stewart <dons@cse.unsw.edu.au>2007-03-09 07:01:39 +0100
commit32ddbfb9d42a5633e0ac7e5e7ce4933086b42e92 (patch)
treef6e75bc58bbdabf233913ccf0d5d58879d91f82f /WMonad.hs
parent539ce237c209cf4f161b3ef29110737372047769 (diff)
downloadmetatile-32ddbfb9d42a5633e0ac7e5e7ce4933086b42e92.tar
metatile-32ddbfb9d42a5633e0ac7e5e7ce4933086b42e92.zip
-12 lines, refactor
darcs-hash:20070309060139-9c5c1-451727d42c18072aaaf9224074b7225165d40713
Diffstat (limited to 'WMonad.hs')
-rw-r--r--WMonad.hs15
1 files changed, 3 insertions, 12 deletions
diff --git a/WMonad.hs b/WMonad.hs
index e6e3ae7..322f1f7 100644
--- a/WMonad.hs
+++ b/WMonad.hs
@@ -1,6 +1,6 @@
-----------------------------------------------------------------------------
-- |
--- Module : W.hs
+-- Module : WMonad.hs
-- Copyright : (c) Spencer Janssen 2007
-- License : BSD3-style (see LICENSE)
--
@@ -16,7 +16,7 @@
module WMonad (
W, WorkSpace, WState(..),
- runW, withDisplay, io, io_, forever, spawn, trace, whenJust
+ runW, withDisplay, io, spawn, trace, whenJust
) where
import StackSet (StackSet)
@@ -57,23 +57,14 @@ withDisplay f = gets display >>= f
io :: IO a -> W a
io = liftIO
--- | Lift an IO action into the W monad, discarding any result
-io_ :: IO a -> W ()
-io_ f = liftIO f >> return ()
-
--- | Run an action forever
-forever :: (Monad m) => m a -> m b
-forever a = a >> forever a
-
-- | spawn. Launch an external application
spawn :: String -> W ()
-spawn = io_ . runCommand
+spawn x = io (runCommand x) >> return ()
-- | Run a side effecting action with the current workspace. Like 'when' but
whenJust :: Maybe a -> (a -> W ()) -> W ()
whenJust mg f = maybe (return ()) f mg
-
-- | A 'trace' for the W monad. Logs a string to stderr. The result may
-- be found in your .xsession-errors file
trace :: String -> W ()