on master help sign in
Remove loops test suite.

- It is made redundant by the loops test in Prelude.Common.

commit2f3d30c72d52bb0bc9cd143051c9ce825ae49303 authorpranaysashank <pranaysashank@composewell.com> dateWed 14 Oct 2020, 11:15 (6 years ago) parent42baf52
2 files changed−88
streamly.cabal−10 test/loops.hs−78
streamly.cabal−10
@@ -816,16 +816,6 @@ test-suite string-test
816816 , hspec >= 2.0 && < 3
817817 default-language: Haskell2010
818818
819−test-suite loops
820− import: test-options
821− type: exitcode-stdio-1.0
822− default-language: Haskell2010
823− main-is: loops.hs
824− hs-source-dirs: test
825− build-Depends:
826− streamly
827− , base >= 4.9 && < 5
828−
829819test-suite nested-loops
830820 import: test-options
831821 type: exitcode-stdio-1.0
test/loops.hsdeleted−78
@@ -1,78 +0,0 @@
1−#if !(MIN_VERSION_base(4,11,0))
2−import Data.Semigroup ((<>))
3−#endif
4−import System.IO (stdout, hSetBuffering, BufferMode(LineBuffering))
5−import Streamly.Prelude
6−
7−main :: IO ()
8−main = do
9− hSetBuffering stdout LineBuffering
10−
11− putStrLn "\nloopTail:\n"
12− drain $ do
13− x <- loopTail 0
14− yieldM $ print (x :: Int)
15−
16− putStrLn "\nloopHead:\n"
17− drain $ do
18− x <- loopHead 0
19− yieldM $ print (x :: Int)
20−
21− putStrLn "\nloopTailA:\n"
22− drain $ do
23− x <- loopTailA 0
24− yieldM $ print (x :: Int)
25−
26− putStrLn "\nloopHeadA:\n"
27− drain $ do
28− x <- loopHeadA 0
29− yieldM $ print (x :: Int)
30−
31− putStrLn "\nwSerial:\n"
32− drain $ do
33− x <- (return 0 <> return 1) `wSerial` (return 100 <> return 101)
34− yieldM $ print (x :: Int)
35−
36− putStrLn "\nParallel interleave:\n"
37− drain $ do
38− x <- (return 0 <> return 1) `wAsync` (return 100 <> return 101)
39− yieldM $ print (x :: Int)
40−
41− where
42−
43−-------------------------------------------------------------------------------
44−-- Serial (single-threaded) stream generator loops
45−-------------------------------------------------------------------------------
46−
47− -- Generates a value and then loops. Can be used to generate an infinite
48− -- stream. Interleaves the generator and the consumer.
49− loopTail :: Int -> Serial Int
50− loopTail x = do
51− yieldM $ putStrLn "LoopTail..."
52− return x <> (if x < 3 then loopTail (x + 1) else nil)
53−
54− -- Loops and then generates a value. The consumer can run only after the
55− -- loop has finished. An infinite generator will not let the consumer run
56− -- at all.
57− loopHead :: Int -> Serial Int
58− loopHead x = do
59− yieldM $ putStrLn "LoopHead..."
60− (if x < 3 then loopHead (x + 1) else nil) <> return x
61−
62−-------------------------------------------------------------------------------
63−-- Concurrent (multi-threaded) adaptive demand-based stream generator loops
64−-------------------------------------------------------------------------------
65−
66− loopTailA :: Int -> Serial Int
67− loopTailA x = do
68− yieldM $ putStrLn "LoopTailA..."
69− return x `async` (if x < 3 then loopTailA (x + 1) else nil)
70−
71− loopHeadA :: Int -> Serial Int
72− loopHeadA x = do
73− yieldM $ putStrLn "LoopHeadA..."
74− (if x < 3 then loopHeadA (x + 1) else nil) `async` return x
75−
76−-------------------------------------------------------------------------------
77−-- Parallel (fairly scheduled, multi-threaded) stream generator loops
78−-------------------------------------------------------------------------------