format-status 0.1.0.2 → 0.1.2.3
raw patch · 2 files changed
+18/−7 lines, 2 filesdep ~data-concurrent-queue
Dependency ranges changed: data-concurrent-queue
Files
- Main.lhs +12/−5
- format-status.cabal +6/−2
Main.lhs view
@@ -6,6 +6,7 @@ > import qualified Data.Text.IO as TIO > import Control.Exception > import System.IO.Error (IOError)+> import qualified System.IO.Error as E > import Data.Time > import System.IO > import System.Locale@@ -14,13 +15,14 @@ > data Msg = Line T.Text > | Tick > | Done+> | Error IOError > gitLine :: IO (Either IOError T.Text) > gitLine = try TIO.getLine > ticksProc :: (Q.PutQueue q IO) => Int -> q Msg -> IO () > ticksProc interval chan = do-> threadDelay (interval * 10)+> threadDelay (interval * 100) > Q.put chan $! Tick > ticksProc interval chan @@ -28,16 +30,21 @@ > linesProc chan = do > l <- gitLine > case l of-> Left err -> do-> Q.put chan Done+> Left err +> | E.isEOFError err -> do+> Q.put chan Done+> | otherwise -> do+> Q.put chan $ Error err > Right line -> do-> Q.put chan $! Line line+> Q.put chan $ Line line > linesProc chan > output :: (Q.TakeQueue q IO) => T.Text -> q Msg -> IO () > output state chan = do > m <- Q.take chan > case m of+> Error e ->+> throwIO e > Done -> > return () > Tick ->@@ -54,7 +61,7 @@ > main :: IO () > main = do-> chan <- newChan+> chan <- newEmptyMVar > _ <- forkIO $ linesProc chan > _ <- forkIO $ ticksProc 500 chan > output "" chan
format-status.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: format-status-version: 0.1.0.2+version: 0.1.2.3 synopsis: A utility for writing the date to dzen2. -- description: license: MIT@@ -19,7 +19,11 @@ main-is: Main.lhs -- other-modules: other-extensions: OverloadedStrings- build-depends: base >=4.5 && <4.6, text >=1.1 && <1.2, time >=1.4 && <1.5, old-locale >=1.0.0 && <1.1.0, data-concurrent-queue == 0.3.0.0+ build-depends: base >=4.5 && <4.6,+ text >=1.1 && <1.2,+ time >=1.4 && <1.5,+ old-locale >=1.0.0 && <1.1.0,+ data-concurrent-queue >= 0.3.0.0 && <0.4.0.0 -- hs-source-dirs: default-language: Haskell2010 ghc-options: -O2