@@ -277,11 +277,6 @@ main = hspec $ do
277 it "Nests two streams using applicative async composition" nestTwoAsyncApp
277 it "Nests two streams using applicative async composition" nestTwoAsyncApp
278 it "Nests two streams using applicative parallel composition" nestTwoParallelApp
278 it "Nests two streams using applicative parallel composition" nestTwoParallelApp
280− it "Nests two streams using Num serial composition" nestTwoSerialNum
281− it "Nests two streams using Num interleaved composition" nestTwoInterleavedNum
282− it "Nests two streams using Num async composition" nestTwoAsyncNum
283− it "Nests two streams using Num parallel composition" nestTwoParallelNum
285 ---------------------------------------------------------------------------
280 ---------------------------------------------------------------------------
286 -- TBD Bind and Bind combinations
281 -- TBD Bind and Bind combinations
287 ---------------------------------------------------------------------------
282 ---------------------------------------------------------------------------
@@ -402,13 +397,6 @@ nestTwoSerialApp =
402 in toListSerial ((+) <$> s1 <*> s2)
397 in toListSerial ((+) <$> s1 <*> s2)
403 `shouldReturn` ([6,7,8,9,7,8,9,10,8,9,10,11,9,10,11,12] :: [Int])
398 `shouldReturn` ([6,7,8,9,7,8,9,10,8,9,10,11,9,10,11,12] :: [Int])
405−nestTwoSerialNum :: Expectation
407− let s1 = foldMapWith (<>) return [1..4]
408− s2 = foldMapWith (<>) return [5..8]
409− in toListSerial (s1 + s2)
410− `shouldReturn` ([6,7,8,9,7,8,9,10,8,9,10,11,9,10,11,12] :: [Int])
412nestTwoInterleaved :: Expectation
400nestTwoInterleaved :: Expectation
413nestTwoInterleaved =
401nestTwoInterleaved =
414 let s1 = foldMapWith (<>) return [1..4]
402 let s1 = foldMapWith (<>) return [1..4]
@@ -426,13 +414,6 @@ nestTwoInterleavedApp =
426 in toListInterleaved ((+) <$> s1 <*> s2)
414 in toListInterleaved ((+) <$> s1 <*> s2)
427 `shouldReturn` ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
415 `shouldReturn` ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
429−nestTwoInterleavedNum :: Expectation
430−nestTwoInterleavedNum =
431− let s1 = foldMapWith (<>) return [1..4]
432− s2 = foldMapWith (<>) return [5..8]
433− in toListInterleaved (s1 + s2)
434− `shouldReturn` ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
436nestTwoAsync :: Expectation
417nestTwoAsync :: Expectation
437nestTwoAsync =
418nestTwoAsync =
438 let s1 = foldMapWith (<>) return [1..4]
419 let s1 = foldMapWith (<>) return [1..4]
@@ -451,13 +432,6 @@ nestTwoAsyncApp =
451 in (toListAsync ((+) <$> s1 <*> s2) >>= return . sort)
432 in (toListAsync ((+) <$> s1 <*> s2) >>= return . sort)
452 `shouldReturn` sort ([6,7,8,9,7,8,9,10,8,9,10,11,9,10,11,12] :: [Int])
433 `shouldReturn` sort ([6,7,8,9,7,8,9,10,8,9,10,11,9,10,11,12] :: [Int])
454−nestTwoAsyncNum :: Expectation
456− let s1 = foldMapWith (<>) return [1..4]
457− s2 = foldMapWith (<>) return [5..8]
458− in (toListAsync (s1 + s2) >>= return . sort)
459− `shouldReturn` sort ([6,7,8,9,7,8,9,10,8,9,10,11,9,10,11,12] :: [Int])
461nestTwoParallel :: Expectation
435nestTwoParallel :: Expectation
462nestTwoParallel =
436nestTwoParallel =
463 let s1 = foldMapWith (<>) return [1..4]
437 let s1 = foldMapWith (<>) return [1..4]
@@ -476,13 +450,6 @@ nestTwoParallelApp =
476 in (toListParallel ((+) <$> s1 <*> s2) >>= return . sort)
450 in (toListParallel ((+) <$> s1 <*> s2) >>= return . sort)
477 `shouldReturn` sort ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
451 `shouldReturn` sort ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
479−nestTwoParallelNum :: Expectation
481− let s1 = foldMapWith (<>) return [1..4]
482− s2 = foldMapWith (<>) return [5..8]
483− in (toListParallel (s1 + s2) >>= return . sort)
484− `shouldReturn` sort ([6,7,7,8,8,8,9,9,9,9,10,10,10,11,11,12] :: [Int])
486timed :: MonadIO (t IO) => Int -> t IO Int
453timed :: MonadIO (t IO) => Int -> t IO Int
487timed x = liftIO (threadDelay (x * 100000)) >> return x
454timed x = liftIO (threadDelay (x * 100000)) >> return x