on master help sign in
Add a test for "each" to test multiple threads
8a1d5d9Harendra Kumar
test/Main.hs+2
@@ -28,6 +28,8 @@ main = hspec $ do
28 toList (return 0 <> return 1) `shouldReturn` ([0, 1] :: [Int])
28 toList (return 0 <> return 1) `shouldReturn` ([0, 1] :: [Int])
29 it "Alternative composition" $
29 it "Alternative composition" $
30 ((toList $ (return 0 <|> return 1)) >>= return . sort) `shouldReturn` ([0, 1] :: [Int])
30 ((toList $ (return 0 <|> return 1)) >>= return . sort) `shouldReturn` ([0, 1] :: [Int])
31+ it "Alternative composition - each" $
32+ ((toList $ each [1..100]) >>= return . sort) `shouldReturn` ([1..100] :: [Int])
31 {-
33 {-
32 it "Alternative composition of async and sync tasks" $
34 it "Alternative composition of async and sync tasks" $
33 ((wait (threads 0 ((async (return 0) <|> return 1)))) >>= return . sort)
35 ((wait (threads 0 ((async (return 0) <|> return 1)))) >>= return . sort)