From 58427c76c892334522dfb28ea2d2a858469fc65a Mon Sep 17 00:00:00 2001 From: Jochen Keil Date: Thu, 9 Aug 2012 09:43:49 +0200 Subject: Cosmetic surgery Realign methods, remove unnecessary imports and remove clutter --- src/Commands.hs | 16 ++++++++-------- src/Main.hs | 2 +- src/Plugins/BufferedPipeReader.hs | 6 ------ src/Window.hs | 1 - 4 files changed, 9 insertions(+), 16 deletions(-) diff --git a/src/Commands.hs b/src/Commands.hs index f31c53c..b501022 100644 --- a/src/Commands.hs +++ b/src/Commands.hs @@ -35,14 +35,14 @@ import Signal import XUtil class Show e => Exec e where - alias :: e -> String - alias e = takeWhile (not . isSpace) $ show e - rate :: e -> Int - rate _ = 10 - run :: e -> IO String - run _ = return "" - start :: e -> (String -> IO ()) -> IO () - start e cb = go + alias :: e -> String + alias e = takeWhile (not . isSpace) $ show e + rate :: e -> Int + rate _ = 10 + run :: e -> IO String + run _ = return "" + start :: e -> (String -> IO ()) -> IO () + start e cb = go where go = run e >>= cb >> tenthSeconds (rate e) >> go trigger :: e -> (Maybe SignalType -> IO ()) -> IO () trigger _ sh = sh Nothing diff --git a/src/Main.hs b/src/Main.hs index c7045b5..5ef5db6 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -36,7 +36,7 @@ import System.Environment import System.Posix.Files import Control.Monad (unless) -import Signal (setupSignalHandler, SignalType(..)) +import Signal (setupSignalHandler) -- $main diff --git a/src/Plugins/BufferedPipeReader.hs b/src/Plugins/BufferedPipeReader.hs index 1fb9dcb..e232916 100644 --- a/src/Plugins/BufferedPipeReader.hs +++ b/src/Plugins/BufferedPipeReader.hs @@ -18,18 +18,12 @@ import Control.Monad(forM_, when) import Control.Concurrent import Control.Concurrent.STM import System.IO --- import System.IO.Unsafe(unsafePerformIO) import Plugins data BufferedPipeReader = BufferedPipeReader String [(Int, String)] deriving (Read, Show) --- pipeState :: MVar String --- pipeState = unsafePerformIO $ newMVar "" - --- pipe :: (String -> IO ()) -> Handle -> IO () --- pipe cb h = hGetLineSafe h >>= cb instance Exec BufferedPipeReader where alias ( BufferedPipeReader a _ ) = a diff --git a/src/Window.hs b/src/Window.hs index e59c5ff..9024fff 100644 --- a/src/Window.hs +++ b/src/Window.hs @@ -5,7 +5,6 @@ import Graphics.X11.Xlib hiding (textExtents, textWidth) import Graphics.X11.Xlib.Extras import Graphics.X11.Xinerama -import Control.Monad.Reader import Data.Maybe(fromMaybe) import System.Posix.Process (getProcessID) -- cgit v1.2.3