packages feed

hydra-print 0.1.0.2 → 0.1.0.3

raw patch · 3 files changed

+41/−26 lines, 3 filesdep ~basedep ~ncursesnew-component:exe:systemtest-hydra-print

Dependency ranges changed: base, ncurses

Files

SystemTest.hs view
@@ -1,6 +1,8 @@ {-# LANGUAGE CPP #-}--- This isn't a unit test. +-- | Simple system test of hydra print.  Creates a main stream, and then adds three+--   child streams dynamically, which all expire before the main stream does.+ module Main where  import UI.HydraPrint @@ -14,27 +16,28 @@ import Prelude as P import System.Environment (getArgs) ---baseStrmRate = 1000 -- Seconds--- baseStrmRate = 500--- baseStrmRate = 100  --- windowLife = 1000-windowLife = 1500- main :: IO () main = do   args <- getArgs+  -- Milliseconds:   let baseStrmRate =         case args of           [b] -> read b           _   -> 100+          +      -- A scaling parameter for how long the windows stay open:+      windowLife = 500 -- 1000+      -- windowLife = 1500      c1 <- newIORef 1   s1 <- S.makeInputStream $ do           c <- readIORef (c1 :: IORef Int)           threadDelay$ 2000 * baseStrmRate           writeIORef c1 (c+1)-          return$ Just$ B.pack$ show (100 * c) ++"\n"+          if c >= (20 * windowLife) `quot` baseStrmRate+           then return Nothing  +           else return$ Just$ B.pack$ show (100 * c) ++"\n"                 strmChan <- newChan   writeChan strmChan (Just ("Strm-0",s1))
UI/HydraPrint.hs view
@@ -39,11 +39,11 @@ import qualified Data.ByteString.Char8 as B import Data.ByteString.Char8 (ByteString) import Data.ByteString.Unsafe (unsafeUseAsCStringLen)-import Prelude as P +import Prelude as P import Control.Monad import Control.Concurrent (threadDelay) import Control.Monad.IO.Class (liftIO, MonadIO)-import Control.Exception+import qualified Control.Exception as E import Foreign.C.String (withCAStringLen)  import qualified System.IO.Streams as S@@ -308,9 +308,9 @@   let        width' = wid - borderLeft -- - borderRight       blank  = P.replicate (w2i width') blankChar-  io$ evaluate hght-  io$ evaluate wid-  io$ evaluate wp+  -- io$ E.evaluate hght+  -- io$ E.evaluate wid+  -- io$ E.evaluate wp   forM_ [borderTop .. hght - borderBottom - 1 ] $ \ yind -> do     moveCursor (w2i yind) (w2i borderLeft)     drawString blank@@ -424,10 +424,11 @@         repaint        -- Redraw all text AND the border:+      repaint :: Curses ()         repaint = do         cwin@(CWindow wp (y,x,_,_) _) <- io$ readIORef winRef+        newhist <- io$ readIORef revHist         updateWindow wp $ do-         newhist <- io$ readIORef revHist          let y'    = y - borderTop - borderBottom              shown = P.take (w2i y') newhist              padY  = y' - i2w(P.length shown)@@ -971,7 +972,7 @@ #endif  removeIfExists :: FilePath -> IO ()-removeIfExists fileName = removeFile fileName `catch` handleExists+removeIfExists fileName = removeFile fileName `E.catch` handleExists   where handleExists e           | isDoesNotExistError e = return ()-          | otherwise = throwIO e+          | otherwise = E.throwIO e
hydra-print.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                hydra-print-version:             0.1.0.2+version:             0.1.0.3 synopsis:            NCurses interface to view multiple ByteString streams in parallel. description:  @@ -37,20 +37,20 @@   Exposed-modules:  UI.HydraPrint                     Scripting.Parallel.ThreadPool   CPP-options: -DNOTESTING-  build-depends: base <= 4.7, transformers, containers, text, bytestring, io-streams,-                 semigroups, mtl, ncurses, directory, async+  build-depends: base >= 4.5 && <= 4.7, transformers, containers, text, bytestring, io-streams,+                 semigroups, mtl, ncurses >= 0.2.3, directory, async -- TEMP: I seem to need to include these even though they are used only by the EXECUTABLES:                  , unix, process, time, random   -- build-depends base ==4.6.*, transformers ==0.3.*, containers ==0.5.*, text ==0.11.*,    --               mtl ==2.1.*, semigroups ==0.9.*,   --               bytestring ==0.10.*, io-streams ==1.0.*, hscurses ==1.4.* -Test-Suite test-hydra-print+Test-Suite unittest-hydra-print     type:       exitcode-stdio-1.0     main-is:    TestFramework.hs     -- DUPLICATED from above-    build-depends: base <= 4.7, transformers, containers, text, bytestring, io-streams,-                   semigroups, mtl, ncurses, directory, async,+    build-depends: base >= 4.5 && <= 4.7, transformers, containers, text, bytestring, io-streams,+                   semigroups, mtl, ncurses >= 0.2.3, directory, async,                    unix, process, time, random,     -- Additional dependencies:     ---------------------------@@ -61,19 +61,30 @@                    test-framework-quickcheck2 ==0.3.*,                    test-framework-th          ==0.2.* +-- Test-Suite systemtest-hydra-print+--    type:       exitcode-stdio-1.0+-- This needs a proper terminal to run, so we leave it to the user, rather than+-- running it as a cabal test suite.+Executable systemtest-hydra-print+    main-is:    SystemTest.hs+    CPP-options: -DNOTESTING      +    -- DUPLICATED from above+    build-depends: base >= 4.5 && <= 4.7, transformers, containers, text, bytestring, io-streams,+                   semigroups, mtl, ncurses >= 0.2.3, directory, async,+                   unix, process, time, random  Executable hydra-view   main-is:           hydra-view.hs   CPP-options: -DNOTESTING  -  build-depends: base <= 4.7, transformers, containers, text, bytestring, io-streams,-                 semigroups, mtl, ncurses, directory, async, unix, +  build-depends: base >= 4.5 && <= 4.7, transformers, containers, text, bytestring, io-streams,+                 semigroups, mtl, ncurses >= 0.2.3, directory, async, unix,                   filepath, process, time, random  Executable hydra-head   main-is:           hydra-head.hs   CPP-options: -DNOTESTING  -  build-depends: base <= 4.7, transformers, containers, text, bytestring, io-streams,-                 semigroups, mtl, ncurses, directory, async, unix, +  build-depends: base >= 4.5 && <= 4.7, transformers, containers, text, bytestring, io-streams,+                 semigroups, mtl, ncurses >= 0.2.3, directory, async, unix,                   filepath, process, time, random