packages feed

concurrent-machines 0.3.1 → 0.3.1.1

raw patch · 2 files changed

+30/−6 lines, 2 filesdep ~basedep ~timePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base, time

API changes (from Hackage documentation)

Files

concurrent-machines.cabal view
@@ -1,5 +1,5 @@ name:                concurrent-machines-version:             0.3.1+version:             0.3.1.1 synopsis:            Concurrent networked stream transducers  description: A simple use-case for this library is to run the stages@@ -54,10 +54,10 @@   -- other-modules:   other-extensions:    GADTs, FlexibleContexts, RankNTypes, TupleSections,                        ScopedTypeVariables-  build-depends:       base >= 4.8 && < 4.10,+  build-depends:       base >= 4.8 && < 5,                        monad-control >= 1.0 && < 1.1,                        transformers >= 0.4 && < 0.6,-                       time >= 1.4 && < 1.9,+                       time >= 1.4 && < 1.10,                        containers >= 0.5 && < 0.6,                        transformers-base >= 0.4 && < 0.6,                        machines >= 0.5 && < 0.7,@@ -72,7 +72,7 @@   type: exitcode-stdio-1.0   hs-source-dirs: tests   main-is: AllTests.hs-  ghc-options: -Wall -O0+  ghc-options: -Wall -threaded   default-language: Haskell2010   build-depends: base >= 4.6 && < 5, concurrent-machines, machines,                  tasty, tasty-hunit, transformers, time
tests/AllTests.hs view
@@ -1,4 +1,6 @@+{-# LANGUAGE RankNTypes #-} import Data.Time.Clock (getCurrentTime, diffUTCTime)+import Control.Applicative ((<|>)) import Control.Concurrent (threadDelay) import Control.Monad.IO.Class (MonadIO, liftIO) import Data.Machine.Concurrent@@ -17,6 +19,28 @@              t2 <- liftIO getCurrentTime              return (r, realToFrac $ t2 `diffUTCTime` t1) ++-- Based on GitHub Issue 7+-- https://github.com/acowley/concurrent-machines/issues/7+alternativeWorks :: TestTree+alternativeWorks = testCase "alternative" $ do+  xs <- runT (replicated 5 "Step" ~> construct aux)+  assertEqual "Results" (replicate 5 "Step" ++ ["Done"]) xs+  where aux = do x <- await <|> yield "Done" *> stop+                 yield x+                 aux++alternativeWorksDelay :: TestTree+alternativeWorksDelay = testCase "alternative with delay" $ do+  xs <- runT (construct (gen 5) ~> construct aux)+  assertEqual "Results" (replicate 5 "Step" ++ ["Done"]) xs+  where aux = do x <- await <|> yield "Done" *> stop+                 yield x+                 aux+        gen :: MonadIO m => Int -> PlanT k String m a+        gen 0 = stop+        gen n = yield "Step" >> liftIO (threadDelay 100000) >> gen (n-1)+ pipeline :: TestTree pipeline = testCaseSteps "pipeline" $ \step -> do   (r,dt) <- timed . runT . supply (repeat ()) $@@ -46,6 +70,6 @@                                       yield (x * 2)  main :: IO ()-main = defaultMain $ +main = defaultMain $        testGroup "concurrent-machines"-       [ pipeline, workStealing ]+       [ pipeline, workStealing, alternativeWorks, alternativeWorksDelay ]