@@ -48,8 +48,8 @@ equals eq stream list = do
4848 when (not $ stream `eq` list) $
4949 monitor
5050 (counterexample $
51− "stream " ++ show stream
52− ++ "\nlist " ++ show list
51+ "stream " <> show stream
52+ <> "\nlist " <> show list
5353 )
5454 assert (stream `eq` list)
5555
@@ -58,17 +58,17 @@ listEquals
5858 => ([a] -> [a] -> Bool) -> [a] -> [a] -> PropertyM m ()
5959listEquals eq stream list = do
6060 when (not $ stream `eq` list) $ liftIO $ putStrLn $
61− "stream " ++ show stream
62− ++ "\nlist " ++ show list
63− ++ "\nstream \\\\ list " ++ show (stream \\ list)
64− ++ "\nlist \\\\ stream " ++ show (list \\ stream)
61+ "stream " <> show stream
62+ <> "\nlist " <> show list
63+ <> "\nstream \\\\ list " <> show (stream \\ list)
64+ <> "\nlist \\\\ stream " <> show (list \\ stream)
6565 when (not $ stream `eq` list) $
6666 monitor
6767 (counterexample $
68− "stream " ++ show stream
69− ++ "\nlist " ++ show list
70− ++ "\nstream \\\\ list " ++ show (stream \\ list)
71− ++ "\nlist \\\\ stream " ++ show (list \\ stream)
68+ "stream " <> show stream
69+ <> "\nlist " <> show list
70+ <> "\nstream \\\\ list " <> show (stream \\ list)
71+ <> "\nlist \\\\ stream " <> show (list \\ stream)
7272 )
7373 assert (stream `eq` list)
7474
@@ -100,11 +100,11 @@ transformFromList constr eq listOp op a =
100100
101101mvarExcHandler :: String -> BlockedIndefinitelyOnMVar -> IO ()
102102mvarExcHandler label BlockedIndefinitelyOnMVar =
103− error $ label ++ " " ++ "BlockedIndefinitelyOnMVar\n"
103+ error $ label <> " " <> "BlockedIndefinitelyOnMVar\n"
104104
105105stmExcHandler :: String -> BlockedIndefinitelyOnSTM -> IO ()
106106stmExcHandler label BlockedIndefinitelyOnSTM =
107− error $ label ++ " " ++ "BlockedIndefinitelyOnSTM\n"
107+ error $ label <> " " <> "BlockedIndefinitelyOnSTM\n"
108108
109109dbgMVar :: String -> IO () -> IO ()
110110dbgMVar label action =
@@ -115,10 +115,10 @@ dbgMVar label action =
115115-- | first n actions takeMVar and the last action performs putMVar n times
116116mvarSequenceOp :: MVar () -> Word8 -> Word8 -> IO Word8
117117mvarSequenceOp mv n x = do
118− let msg = show x ++ "/" ++ show n
118+ let msg = show x <> "/" <> show n
119119 if x < n
120− then dbgMVar ("take mvarSequenceOp " ++ msg) (takeMVar mv) >> return x
121− else dbgMVar ("put mvarSequenceOp" ++ msg)
120+ then dbgMVar ("take mvarSequenceOp " <> msg) (takeMVar mv) >> return x
121+ else dbgMVar ("put mvarSequenceOp" <> msg)
122122 (replicateM_ (fromIntegral n) (putMVar mv ())) >> return x
123123
124124concurrentMapM
@@ -132,7 +132,7 @@ concurrentMapM constr eq op n =
132132 let list = [0..n]
133133 stream <- run $ do
134134 mv <- newEmptyMVar :: IO (MVar ())
135− (S.toList . (op n mv)) (constr list)
135+ (S.toList . op n mv) (constr list)
136136 listEquals eq stream list
137137
138138concurrentFromFoldable
@@ -146,7 +146,7 @@ concurrentFromFoldable eq op n =
146146 let list = [0..n]
147147 stream <- run $ do
148148 mv <- newEmptyMVar :: IO (MVar ())
149− (S.toList . op) (S.fromFoldableM (map (mvarSequenceOp mv n) list))
149+ (S.toList . op) (S.fromFoldableM (fmap (mvarSequenceOp mv n) list))
150150 listEquals eq stream list
151151
152152sourceUnfoldrM :: IsStream t => MVar () -> Word8 -> t IO Word8
@@ -155,11 +155,11 @@ sourceUnfoldrM mv n = S.unfoldrM step 0
155155 -- argument must be integer to avoid overflow of word8 at 255
156156 step :: Int -> IO (Maybe (Word8, Int))
157157 step cnt = do
158− let msg = show cnt ++ "/" ++ show n
158+ let msg = show cnt <> "/" <> show n
159159 if cnt > fromIntegral n
160160 then return Nothing
161161 else do
162− dbgMVar ("put sourceUnfoldrM " ++ msg) (putMVar mv ())
162+ dbgMVar ("put sourceUnfoldrM " <> msg) (putMVar mv ())
163163 return (Just (fromIntegral cnt, cnt + 1))
164164
165165-- Note that this test is not guaranteed to succeed, because there is no
@@ -175,7 +175,7 @@ concurrentUnfoldrM eq op n =
175175 -- XXX we should test empty list case as well
176176 let list = [0..n]
177177 stream <- run $ do
178− -- putStrLn $ "concurrentUnfoldrM: " ++ show n
178+ -- putStrLn $ "concurrentUnfoldrM: " <> show n
179179 mv <- newEmptyMVar :: IO (MVar ())
180180 cnt <- newIORef 0
181181 -- since unfoldr happens in parallel with the stream processing we
@@ -188,18 +188,14 @@ concurrentUnfoldrM eq op n =
188188 -- instead.
189189 i <- S.yieldM $ readIORef cnt
190190 S.yieldM $ modifyIORef cnt (+1)
191− let msg = show i ++ "/" ++ show n
192− S.yieldM $ do
193− if even i
194− then do
195− dbgMVar ("first take concurrentUnfoldrM " ++ msg)
191+ let msg = show i <> "/" <> show n
192+ S.yieldM $
193+ when (even i) $ do
194+ dbgMVar ("first take concurrentUnfoldrM " <> msg)
196195 (takeMVar mv)
197− if n > i
198− then do
199− dbgMVar ("second take concurrentUnfoldrM " ++ msg)
196+ when (n > i) $
197+ dbgMVar ("second take concurrentUnfoldrM " <> msg)
200198 (takeMVar mv)
201− else return ()
202− else return ()
203199 return x
204200 listEquals eq stream list
205201
@@ -213,24 +209,21 @@ concurrentApplication eq t n = withMaxSuccess maxTestCount $
213209 -- XXX we should test empty list case as well
214210 let list = [0..n]
215211 stream <- run $ do
216− -- putStrLn $ "concurrentApplication: " ++ show n
212+ -- putStrLn $ "concurrentApplication: " <> show n
217213 mv <- newEmptyMVar :: IO (MVar ())
218214 -- since unfoldr happens in parallel with the stream processing we
219215 -- can do two takeMVar in one iteration. If it is not parallel then
220216 -- this will not work and the test will fail.
221− (S.toList . t) $ do
217+ (S.toList . t) $
222218 sourceUnfoldrM mv n |&
223− (S.mapM $ \x -> do
224− let msg = show x ++ "/" ++ show n
225− if even x
226− then do
227− dbgMVar ("first take concurrentApp " ++ msg)
219+ S.mapM (\x -> do
220+ let msg = show x <> "/" <> show n
221+ when (even x) $ do
222+ dbgMVar ("first take concurrentApp " <> msg)
228223 (takeMVar mv)
229− if n > x
230− then dbgMVar ("second take concurrentApp " ++ msg)
224+ when (n > x) $
225+ dbgMVar ("second take concurrentApp " <> msg)
231226 (takeMVar mv)
232− else return ()
233− else return ()
234227 return x)
235228 listEquals eq stream list
236229
@@ -239,7 +232,7 @@ sourceUnfoldrM1 n = S.unfoldrM step 0
239232 where
240233 -- argument must be integer to avoid overflow of word8 at 255
241234 step :: Int -> IO (Maybe (Word8, Int))
242− step cnt = do
235+ step cnt =
243236 if cnt > fromIntegral n
244237 then return Nothing
245238 else return (Just (fromIntegral cnt, cnt + 1))
@@ -249,7 +242,7 @@ concurrentFoldlApplication n =
249242 monadicIO $ do
250243 -- XXX we should test empty list case as well
251244 let list = [0..n]
252− stream <- run $ do
245+ stream <- run $
253246 sourceUnfoldrM1 n |&. S.foldlM' (\xs x -> return (x : xs)) []
254247 listEquals (==) (reverse stream) list
255248
@@ -258,7 +251,7 @@ concurrentFoldrApplication n =
258251 monadicIO $ do
259252 -- XXX we should test empty list case as well
260253 let list = [0..n]
261− stream <- run $ do
254+ stream <- run $
262255 sourceUnfoldrM1 n |&. S.foldrM (\x xs -> return (x : xs)) []
263256 listEquals (==) stream list
264257
@@ -287,7 +280,7 @@ foldFromList
287280 -> ([Int] -> [Int] -> Bool)
288281 -> [Int]
289282 -> Property
290−foldFromList constr op eq a = transformFromList constr eq id op a
283+foldFromList constr op eq = transformFromList constr eq id op
291284
292285eliminateOp
293286 :: (Show a, Eq a)
@@ -323,8 +316,8 @@ functorOps
323316 -> (t IO Int -> SerialT IO Int)
324317 -> Spec
325318functorOps constr desc eq t = do
326− prop (desc ++ " id") $ transformFromList constr eq id $ t
327− prop (desc ++ " fmap (+1)") $ transformFromList constr eq (fmap (+1)) $ t . (fmap (+1))
319+ prop (desc <> " id") $ transformFromList constr eq id t
320+ prop (desc <> " fmap (+1)") $ transformFromList constr eq (fmap (+1)) $ t . fmap (+1)
328321
329322transformOps
330323 :: IsStream t
@@ -336,48 +329,48 @@ transformOps
336329transformOps constr desc eq t = do
337330 let transform = transformFromList constr eq
338331 -- Filtering
339− prop (desc ++ " filter False") $
340− transform (filter (const False)) $ t . (S.filter (const False))
341− prop (desc ++ " filter True") $
342− transform (filter (const True)) $ t . (S.filter (const True))
343− prop (desc ++ " filter even") $
344− transform (filter even) $ t . (S.filter even)
345−
346− prop (desc ++ " take maxBound") $
347− transform (take maxBound) $ t . (S.take maxBound)
348− prop (desc ++ " take 0") $ transform (take 0) $ t . (S.take 0)
349− prop (desc ++ " take 1") $ transform (take 1) $ t . (S.take 1)
350− prop (desc ++ " take 10") $ transform (take 10) $ t . (S.take 10)
351−
352− prop (desc ++ " takeWhile True") $
353− transform (takeWhile (const True)) $ t . (S.takeWhile (const True))
354− prop (desc ++ " takeWhile False") $
355− transform (takeWhile (const False)) $ t . (S.takeWhile (const False))
356− prop (desc ++ " takeWhile > 0") $
357− transform (takeWhile (> 0)) $ t . (S.takeWhile (> 0))
332+ prop (desc <> " filter False") $
333+ transform (filter (const False)) $ t . S.filter (const False)
334+ prop (desc <> " filter True") $
335+ transform (filter (const True)) $ t . S.filter (const True)
336+ prop (desc <> " filter even") $
337+ transform (filter even) $ t . S.filter even
338+
339+ prop (desc <> " take maxBound") $
340+ transform (take maxBound) $ t . S.take maxBound
341+ prop (desc <> " take 0") $ transform (take 0) $ t . S.take 0
342+ prop (desc <> " take 1") $ transform (take 1) $ t . S.take 1
343+ prop (desc <> " take 10") $ transform (take 10) $ t . S.take 10
344+
345+ prop (desc <> " takeWhile True") $
346+ transform (takeWhile (const True)) $ t . S.takeWhile (const True)
347+ prop (desc <> " takeWhile False") $
348+ transform (takeWhile (const False)) $ t . S.takeWhile (const False)
349+ prop (desc <> " takeWhile > 0") $
350+ transform (takeWhile (> 0)) $ t . S.takeWhile (> 0)
358351
359352 let f x = if odd x then Just (x + 100) else Nothing
360− prop (desc ++ " mapMaybe") $ transform (mapMaybe f) $ t . (S.mapMaybe f)
353+ prop (desc <> " mapMaybe") $ transform (mapMaybe f) $ t . S.mapMaybe f
361354
362− prop (desc ++ " drop maxBound") $
363− transform (drop maxBound) $ t . (S.drop maxBound)
364− prop (desc ++ " drop 0") $ transform (drop 0) $ t . (S.drop 0)
365− prop (desc ++ " drop 1") $ transform (drop 1) $ t . (S.drop 1)
366− prop (desc ++ " drop 10") $ transform (drop 10) $ t . (S.drop 10)
355+ prop (desc <> " drop maxBound") $
356+ transform (drop maxBound) $ t . S.drop maxBound
357+ prop (desc <> " drop 0") $ transform (drop 0) $ t . S.drop 0
358+ prop (desc <> " drop 1") $ transform (drop 1) $ t . S.drop 1
359+ prop (desc <> " drop 10") $ transform (drop 10) $ t . S.drop 10
367360
368− prop (desc ++ " dropWhile True") $
369− transform (dropWhile (const True)) $ t . (S.dropWhile (const True))
370− prop (desc ++ " dropWhile False") $
371− transform (dropWhile (const False)) $ t . (S.dropWhile (const False))
372− prop (desc ++ " dropWhile > 0") $
373− transform (dropWhile (> 0)) $ t . (S.dropWhile (> 0))
374− prop (desc ++ " scan") $ transform (scanl' (+) 0) $ t . (S.scanl' (+) 0)
375− prop (desc ++ " reverse") $ transform reverse $ t . S.reverse
361+ prop (desc <> " dropWhile True") $
362+ transform (dropWhile (const True)) $ t . S.dropWhile (const True)
363+ prop (desc <> " dropWhile False") $
364+ transform (dropWhile (const False)) $ t . S.dropWhile (const False)
365+ prop (desc <> " dropWhile > 0") $
366+ transform (dropWhile (> 0)) $ t . S.dropWhile (> 0)
367+ prop (desc <> " scan") $ transform (scanl' (+) 0) $ t . S.scanl' (+) 0
368+ prop (desc <> " reverse") $ transform reverse $ t . S.reverse
376369
377− prop (desc ++ " findIndices") $ transform (findIndices odd) $ t . (S.findIndices odd)
378− prop (desc ++ " elemIndices") $ transform (elemIndices 3) $ t . (S.elemIndices 3)
370+ prop (desc <> " findIndices") $ transform (findIndices odd) $ t . S.findIndices odd
371+ prop (desc <> " elemIndices") $ transform (elemIndices 3) $ t . S.elemIndices 3
379372
380− prop (desc ++ " intersperseM") $ transform (intersperse 3) $ t . (S.intersperseM (return 3))
373+ prop (desc <> " intersperseM") $ transform (intersperse 3) $ t . S.intersperseM (return 3)
381374
382375
383376concurrentOps
@@ -390,15 +383,15 @@ concurrentOps
390383concurrentOps constr desc eq t = do
391384 let prop1 d p = prop d $ withMaxSuccess maxTestCount p
392385
393− prop1 (desc ++ " fromFoldableM") $ concurrentFromFoldable eq t
394− prop1 (desc ++ " unfoldrM") $ concurrentUnfoldrM eq t
386+ prop1 (desc <> " fromFoldableM") $ concurrentFromFoldable eq t
387+ prop1 (desc <> " unfoldrM") $ concurrentUnfoldrM eq t
395388 -- we pass it the length of the stream n and an mvar mv.
396389 -- The stream is [0..n]. The threads communicate in such a way that the
397390 -- actions coming first in the stream are dependent on the last action. So
398391 -- if the stream is not processed concurrently it will block forever.
399392 -- Note that if the size of the stream is bigger than the thread limit
400393 -- then it will block even if it is concurrent.
401− prop1 (desc ++ " mapM") $
394+ prop1 (desc <> " mapM") $
402395 concurrentMapM constr eq $ \n mv stream ->
403396 t $ S.mapM (mvarSequenceOp mv n) stream
404397
@@ -414,58 +407,58 @@ transformCombineOpsCommon
414407transformCombineOpsCommon constr desc eq t = do
415408 let transform = transformCombineFromList constr eq
416409 -- Filtering
417− prop (desc ++ " filter False") $
410+ prop (desc <> " filter False") $
418411 transform (filter (const False)) t (S.filter (const False))
419− prop (desc ++ " filter True") $
412+ prop (desc <> " filter True") $
420413 transform (filter (const True)) t (S.filter (const True))
421− prop (desc ++ " filter even") $
414+ prop (desc <> " filter even") $
422415 transform (filter even) t (S.filter even)
423416
424− prop (desc ++ " filterM False") $
417+ prop (desc <> " filterM False") $
425418 transform (filter (const False)) t (S.filterM (const $ return False))
426− prop (desc ++ " filterM True") $
419+ prop (desc <> " filterM True") $
427420 transform (filter (const True)) t (S.filterM (const $ return True))
428− prop (desc ++ " filterM even") $
421+ prop (desc <> " filterM even") $
429422 transform (filter even) t (S.filterM (return . even))
430423
431− prop (desc ++ " take maxBound") $
424+ prop (desc <> " take maxBound") $
432425 transform (take maxBound) t (S.take maxBound)
433− prop (desc ++ " take 0") $ transform (take 0) t (S.take 0)
426+ prop (desc <> " take 0") $ transform (take 0) t (S.take 0)
434427
435− prop (desc ++ " takeWhile True") $
428+ prop (desc <> " takeWhile True") $
436429 transform (takeWhile (const True)) t (S.takeWhile (const True))
437− prop (desc ++ " takeWhile False") $
430+ prop (desc <> " takeWhile False") $
438431 transform (takeWhile (const False)) t (S.takeWhile (const False))
439432
440− prop (desc ++ " takeWhileM True") $
433+ prop (desc <> " takeWhileM True") $
441434 transform (takeWhile (const True)) t (S.takeWhileM (const $ return True))
442− prop (desc ++ " takeWhileM False") $
435+ prop (desc <> " takeWhileM False") $
443436 transform (takeWhile (const False)) t (S.takeWhileM (const $ return False))
444437
445− prop (desc ++ " drop maxBound") $
438+ prop (desc <> " drop maxBound") $
446439 transform (drop maxBound) t (S.drop maxBound)
447− prop (desc ++ " drop 0") $ transform (drop 0) t (S.drop 0)
440+ prop (desc <> " drop 0") $ transform (drop 0) t (S.drop 0)
448441
449− prop (desc ++ " dropWhile True") $
442+ prop (desc <> " dropWhile True") $
450443 transform (dropWhile (const True)) t (S.dropWhile (const True))
451− prop (desc ++ " dropWhile False") $
444+ prop (desc <> " dropWhile False") $
452445 transform (dropWhile (const False)) t (S.dropWhile (const False))
453446
454− prop (desc ++ " dropWhileM True") $
447+ prop (desc <> " dropWhileM True") $
455448 transform (dropWhile (const True)) t (S.dropWhileM (const $ return True))
456− prop (desc ++ " dropWhileM False") $
449+ prop (desc <> " dropWhileM False") $
457450 transform (dropWhile (const False)) t (S.dropWhileM (const $ return False))
458451
459− prop (desc ++ " mapM (+1)") $
460− transform (map (+1)) t (S.mapM (\x -> return (x + 1)))
452+ prop (desc <> " mapM (+1)") $
453+ transform (fmap (+1)) t (S.mapM (\x -> return (x + 1)))
461454
462− prop (desc ++ " scan") $ transform (scanl' (flip const) 0) t
455+ prop (desc <> " scan") $ transform (scanl' (flip const) 0) t
463456 (S.scanl' (flip const) 0)
464− prop (desc ++ " scanlM'") $ transform (scanl' (flip const) 0) t
457+ prop (desc <> " scanlM'") $ transform (scanl' (flip const) 0) t
465458 (S.scanlM' (\_ a -> return a) 0)
466− prop (desc ++ " reverse") $ transform reverse t S.reverse
459+ prop (desc <> " reverse") $ transform reverse t S.reverse
467460
468− prop (desc ++ " intersperseM") $
461+ prop (desc <> " intersperseM") $
469462 transform (intersperse 3) t (S.intersperseM $ return 3)
470463
471464transformCombineOpsOrdered
@@ -478,40 +471,36 @@ transformCombineOpsOrdered
478471transformCombineOpsOrdered constr desc eq t = do
479472 let transform = transformCombineFromList constr eq
480473 -- Filtering
481− prop (desc ++ " take 1") $ transform (take 1) t (S.take 1)
474+ prop (desc <> " take 1") $ transform (take 1) t (S.take 1)
482475#ifdef DEVBUILD
483− prop (desc ++ " take 2") $ transform (take 2) t (S.take 2)
484− prop (desc ++ " take 3") $ transform (take 3) t (S.take 3)
485− prop (desc ++ " take 4") $ transform (take 4) t (S.take 4)
486− prop (desc ++ " take 5") $ transform (take 5) t (S.take 5)
476+ prop (desc <> " take 2") $ transform (take 2) t (S.take 2)
477+ prop (desc <> " take 3") $ transform (take 3) t (S.take 3)
478+ prop (desc <> " take 4") $ transform (take 4) t (S.take 4)
479+ prop (desc <> " take 5") $ transform (take 5) t (S.take 5)
487480#endif
488− prop (desc ++ " take 10") $ transform (take 10) t (S.take 10)
481+ prop (desc <> " take 10") $ transform (take 10) t (S.take 10)
489482
490− prop (desc ++ " takeWhile > 0") $
483+ prop (desc <> " takeWhile > 0") $
491484 transform (takeWhile (> 0)) t (S.takeWhile (> 0))
492485
493− prop (desc ++ " drop 1") $ transform (drop 1) t (S.drop 1)
494− prop (desc ++ " drop 10") $ transform (drop 10) t (S.drop 10)
486+ prop (desc <> " drop 1") $ transform (drop 1) t (S.drop 1)
487+ prop (desc <> " drop 10") $ transform (drop 10) t (S.drop 10)
495488
496− prop (desc ++ " dropWhile > 0") $
489+ prop (desc <> " dropWhile > 0") $
497490 transform (dropWhile (> 0)) t (S.dropWhile (> 0))
498− prop (desc ++ " scan") $ transform (scanl' (+) 0) t (S.scanl' (+) 0)
491+ prop (desc <> " scan") $ transform (scanl' (+) 0) t (S.scanl' (+) 0)
499492
500493 -- XXX this does not fail when the SVar is shared, need to fix.
501− prop (desc ++ " concurrent application") $
502− transform (& (map (+1))) t (|& (S.map (+1)))
494+ prop (desc <> " concurrent application") $
495+ transform (& fmap (+1)) t (|& S.map (+1))
503496
504− prop (desc ++ " findIndices") $
497+ prop (desc <> " findIndices") $
505498 transform (findIndices odd) t (S.findIndices odd)
506− prop (desc ++ " elemIndices") $
499+ prop (desc <> " elemIndices") $
507500 transform (elemIndices 0) t (S.elemIndices 0)
508501
509−wrapMaybe :: Eq a1 => ([a1] -> a2) -> [a1] -> Maybe a2
510−wrapMaybe f =
511− \x ->
512− if x == []
513− then Nothing
514− else Just (f x)
502+wrapMaybe :: ([a1] -> a2) -> [a1] -> Maybe a2
503+wrapMaybe f x = if null x then Nothing else Just (f x)
515504
516505eliminationOps
517506 :: ([Int] -> t IO Int)
@@ -520,31 +509,31 @@ eliminationOps
520509 -> Spec
521510eliminationOps constr desc t = do
522511 -- Elimination
523− prop (desc ++ " null") $ eliminateOp constr null $ S.null . t
524− prop (desc ++ " foldl'") $
525− eliminateOp constr (foldl' (+) 0) $ (S.foldl' (+) 0) . t
526− prop (desc ++ " foldl1'") $
527− eliminateOp constr (wrapMaybe $ foldl1' (+)) $ (S.foldl1' (+)) . t
528− prop (desc ++ " foldr1") $
529− eliminateOp constr (wrapMaybe $ foldr1 (+)) $ (S.foldr1 (+)) . t
530− prop (desc ++ " all") $ eliminateOp constr (all even) $ (S.all even) . t
531− prop (desc ++ " any") $ eliminateOp constr (any even) $ (S.any even) . t
532− prop (desc ++ " and") $ eliminateOp constr (and . map (> 0)) $
512+ prop (desc <> " null") $ eliminateOp constr null $ S.null . t
513+ prop (desc <> " foldl'") $
514+ eliminateOp constr (foldl' (+) 0) $ S.foldl' (+) 0 . t
515+ prop (desc <> " foldl1'") $
516+ eliminateOp constr (wrapMaybe $ foldl1' (+)) $ S.foldl1' (+) . t
517+ prop (desc <> " foldr1") $
518+ eliminateOp constr (wrapMaybe $ foldr1 (+)) $ S.foldr1 (+) . t
519+ prop (desc <> " all") $ eliminateOp constr (all even) $ S.all even . t
520+ prop (desc <> " any") $ eliminateOp constr (any even) $ S.any even . t
521+ prop (desc <> " and") $ eliminateOp constr (and . fmap (> 0)) $
533522 (S.and . S.map (> 0)) . t
534− prop (desc ++ " or") $ eliminateOp constr (or . map (> 0)) $
523+ prop (desc <> " or") $ eliminateOp constr (or . fmap (> 0)) $
535524 (S.or . S.map (> 0)) . t
536− prop (desc ++ " length") $ eliminateOp constr length $ S.length . t
537− prop (desc ++ " sum") $ eliminateOp constr sum $ S.sum . t
538− prop (desc ++ " product") $ eliminateOp constr product $ S.product . t
525+ prop (desc <> " length") $ eliminateOp constr length $ S.length . t
526+ prop (desc <> " sum") $ eliminateOp constr sum $ S.sum . t
527+ prop (desc <> " product") $ eliminateOp constr product $ S.product . t
539528
540− prop (desc ++ " maximum") $ eliminateOp constr (wrapMaybe maximum) $ S.maximum . t
541− prop (desc ++ " minimum") $ eliminateOp constr (wrapMaybe minimum) $ S.minimum . t
529+ prop (desc <> " maximum") $ eliminateOp constr (wrapMaybe maximum) $ S.maximum . t
530+ prop (desc <> " minimum") $ eliminateOp constr (wrapMaybe minimum) $ S.minimum . t
542531
543− prop (desc ++ " findIndex") $ eliminateOp constr (findIndex odd) $ (S.findIndex odd) . t
544− prop (desc ++ " elemIndex") $ eliminateOp constr (elemIndex 3) $ (S.elemIndex 3) . t
532+ prop (desc <> " findIndex") $ eliminateOp constr (findIndex odd) $ S.findIndex odd . t
533+ prop (desc <> " elemIndex") $ eliminateOp constr (elemIndex 3) $ S.elemIndex 3 . t
545534
546− prop (desc ++ " find") $ eliminateOp constr (find even) $ (S.find even) . t
547− prop (desc ++ " lookup") $
535+ prop (desc <> " find") $ eliminateOp constr (find even) $ S.find even . t
536+ prop (desc <> " lookup") $
548537 eliminateOp constr (lookup 3 . flip zip [1..]) $
549538 S.lookup 3 . S.zipWith (\a b -> (b, a)) (S.fromList [(1::Int)..]) . t
550539
@@ -556,18 +545,18 @@ serialEliminationOps
556545 -> (t IO Int -> SerialT IO Int)
557546 -> Spec
558547serialEliminationOps constr desc t = do
559− prop (desc ++ " head") $ eliminateOp constr (wrapMaybe head) $ S.head . t
560− prop (desc ++ " tail") $ eliminateOp constr (wrapMaybe tail) $ \x -> do
548+ prop (desc <> " head") $ eliminateOp constr (wrapMaybe head) $ S.head . t
549+ prop (desc <> " tail") $ eliminateOp constr (wrapMaybe tail) $ \x -> do
561550 r <- S.tail (t x)
562551 case r of
563552 Nothing -> return Nothing
564− Just s -> S.toList s >>= return . Just
565− prop (desc ++ " last") $ eliminateOp constr (wrapMaybe last) $ S.last . t
566− prop (desc ++ " init") $ eliminateOp constr (wrapMaybe init) $ \x -> do
553+ Just s -> Just <$> S.toList s
554+ prop (desc <> " last") $ eliminateOp constr (wrapMaybe last) $ S.last . t
555+ prop (desc <> " init") $ eliminateOp constr (wrapMaybe init) $ \x -> do
567556 r <- S.init (t x)
568557 case r of
569558 Nothing -> return Nothing
570− Just s -> S.toList s >>= return . Just
559+ Just s -> Just <$> S.toList s
571560
572561transformOpsWord8
573562 :: ([Word8] -> t IO Word8)
@@ -575,8 +564,8 @@ transformOpsWord8
575564 -> (t IO Word8 -> SerialT IO Word8)
576565 -> Spec
577566transformOpsWord8 constr desc t = do
578− prop (desc ++ " elem") $ elemOp constr t S.elem elem
579− prop (desc ++ " elem") $ elemOp constr t S.notElem notElem
567+ prop (desc <> " elem") $ elemOp constr t S.elem elem
568+ prop (desc <> " elem") $ elemOp constr t S.notElem notElem
580569
581570-- XXX concatenate streams of multiple elements rather than single elements
582571semigroupOps
@@ -591,8 +580,8 @@ semigroupOps
591580 -> (t IO Int -> SerialT IO Int)
592581 -> Spec
593582semigroupOps desc eq t = do
594− prop (desc ++ " <>") $ foldFromList (foldMapWith (<>) singleton) t eq
595− prop (desc ++ " mappend") $ foldFromList (foldMapWith mappend singleton) t eq
583+ prop (desc <> " <>") $ foldFromList (foldMapWith (<>) singleton) t eq
584+ prop (desc <> " mappend") $ foldFromList (foldMapWith mappend singleton) t eq
596585
597586applicativeOps
598587 :: Applicative (t IO)
@@ -603,7 +592,7 @@ applicativeOps
603592 -> Property
604593applicativeOps constr eq t (a, b) = withMaxSuccess maxTestCount $
605594 monadicIO $ do
606− stream <- run ((S.toList . t) ((,) <$> (constr a) <*> (constr b)))
595+ stream <- run ((S.toList . t) ((,) <$> constr a <*> constr b))
607596 let list = (,) <$> a <*> b
608597 listEquals eq stream list
609598
@@ -616,8 +605,8 @@ zipApplicative
616605 -> Property
617606zipApplicative constr eq t (a, b) = withMaxSuccess maxTestCount $
618607 monadicIO $ do
619− stream1 <- run ((S.toList . t) ((,) <$> (constr a) <*> (constr b)))
620− stream2 <- run ((S.toList . t) (pure (,) <*> (constr a) <*> (constr b)))
608+ stream1 <- run ((S.toList . t) ((,) <$> constr a <*> constr b))
609+ stream2 <- run ((S.toList . t) (pure (,) <*> constr a <*> constr b))
621610 stream3 <- run ((S.toList . t) (S.zipWith (,) (constr a) (constr b)))
622611 let list = getZipList $ (,) <$> ZipList a <*> ZipList b
623612 listEquals eq stream1 list
@@ -636,7 +625,7 @@ zipMonadic constr eq t (a, b) = withMaxSuccess maxTestCount $
636625 stream1 <-
637626 run
638627 ((S.toList . t)
639− (S.zipWithM (\x y -> return (x, y)) (constr a) (constr b)))
628+ (S.zipWithM (curry return) (constr a) (constr b)))
640629 let list = getZipList $ (,) <$> ZipList a <*> ZipList b
641630 listEquals eq stream1 list
642631
@@ -652,11 +641,11 @@ zipAsyncMonadic constr eq t (a, b) = withMaxSuccess maxTestCount $
652641 stream1 <-
653642 run
654643 ((S.toList . t)
655− (S.zipWithM (\x y -> return (x, y)) (constr a) (constr b)))
644+ (S.zipWithM (curry return) (constr a) (constr b)))
656645 stream2 <-
657646 run
658647 ((S.toList . t)
659− (S.zipAsyncWithM (\x y -> return (x, y)) (constr a) (constr b)))
648+ (S.zipAsyncWithM (curry return) (constr a) (constr b)))
660649 let list = getZipList $ (,) <$> ZipList a <*> ZipList b
661650 listEquals eq stream1 list
662651 listEquals eq stream2 list
@@ -669,7 +658,7 @@ monadThen
669658 -> ([Int], [Int])
670659 -> Property
671660monadThen constr eq t (a, b) = withMaxSuccess maxTestCount $ monadicIO $ do
672− stream <- run ((S.toList . t) ((constr a) >> (constr b)))
661+ stream <- run ((S.toList . t) (constr a >> constr b))
673662 let list = a >> b
674663 listEquals eq stream list
675664
@@ -685,19 +674,19 @@ monadBind constr eq t (a, b) = withMaxSuccess maxTestCount $
685674 stream <-
686675 run
687676 ((S.toList . t)
688− ((constr a) >>= \x -> (constr b) >>= return . (+ x)))
689− let list = a >>= \x -> b >>= return . (+ x)
677+ (constr a >>= \x -> (+ x) <$> constr b))
678+ let list = a >>= \x -> (+ x) <$> b
690679 listEquals eq stream list
691680
692681constructWithIterate :: IsStream t => (t IO Int -> SerialT IO Int) -> Spec
693682constructWithIterate t = do
694683 it "iterate" $
695− (S.toList . t . (S.take 100) $ (S.iterate (+ 1) (0 :: Int)))
696− `shouldReturn` (take 100 $ iterate (+ 1) 0)
684+ (S.toList . t . S.take 100) (S.iterate (+ 1) (0 :: Int))
685+ `shouldReturn` take 100 (iterate (+ 1) 0)
697686 it "iterateM" $ do
698− let addM = (\ y -> return (y + 1))
699− S.toList . t . (S.take 100) $ S.iterateM addM (0 :: Int)
700− `shouldReturn` (take 100 $ iterate (+ 1) 0)
687+ let addM y = return (y + 1)
688+ S.toList . t . S.take 100 $ S.iterateM addM (0 :: Int)
689+ `shouldReturn` take 100 (iterate (+ 1) 0)
701690
702691main :: IO ()
703692main = hspec
@@ -728,43 +717,43 @@ main = hspec
728717
729718 let mapOps spec = mapM_ (\(desc, f) -> describe desc $ spec f)
730719 let serialOps :: IsStream t => ((SerialT IO a -> t IO a) -> Spec) -> Spec
731− serialOps spec = mapOps spec $ (makeOps serially)
720+ serialOps spec = mapOps spec $ makeOps serially
732721#ifndef COVERAGE_BUILD
733− ++ [("rate AvgRate 0.00000001", serially . avgRate 0.00000001)]
734− ++ [("maxBuffer -1", serially . maxBuffer (-1))]
722+ <> [("rate AvgRate 0.00000001", serially . avgRate 0.00000001)]
723+ <> [("maxBuffer -1", serially . maxBuffer (-1))]
735724#endif
736725 let wSerialOps :: IsStream t => ((WSerialT IO a -> t IO a) -> Spec) -> Spec
737726 wSerialOps spec = mapOps spec $ makeOps wSerially
738727#ifndef COVERAGE_BUILD
739− ++ [("rate AvgRate 0.00000001", wSerially . avgRate 0.00000001)]
740− ++ [("maxBuffer (-1)", wSerially . maxBuffer (-1))]
728+ <> [("rate AvgRate 0.00000001", wSerially . avgRate 0.00000001)]
729+ <> [("maxBuffer (-1)", wSerially . maxBuffer (-1))]
741730#endif
742731 let asyncOps :: IsStream t => ((AsyncT IO a -> t IO a) -> Spec) -> Spec
743732 asyncOps spec = mapOps spec $ makeOps asyncly
744733#ifndef COVERAGE_BUILD
745− ++ [("maxBuffer (-1)", asyncly . maxBuffer (-1))]
734+ <> [("maxBuffer (-1)", asyncly . maxBuffer (-1))]
746735#endif
747736 let wAsyncOps :: IsStream t => ((WAsyncT IO a -> t IO a) -> Spec) -> Spec
748737 wAsyncOps spec = mapOps spec $ makeOps wAsyncly
749738#ifndef COVERAGE_BUILD
750− ++ [("maxBuffer (-1)", wAsyncly . maxBuffer (-1))]
739+ <> [("maxBuffer (-1)", wAsyncly . maxBuffer (-1))]
751740#endif
752741 let aheadOps :: IsStream t => ((AheadT IO a -> t IO a) -> Spec) -> Spec
753742 aheadOps spec = mapOps spec $ makeOps aheadly
754743#ifndef COVERAGE_BUILD
755− ++ [("maxBuffer (-1)", aheadly . maxBuffer (-1))]
744+ <> [("maxBuffer (-1)", aheadly . maxBuffer (-1))]
756745#endif
757746 let parallelOps :: IsStream t => ((ParallelT IO a -> t IO a) -> Spec) -> Spec
758747 parallelOps spec = mapOps spec $ makeOps parallely
759748#ifndef COVERAGE_BUILD
760− ++ [("rate AvgRate 0.00000001", parallely . avgRate 0.00000001)]
761− ++ [("maxBuffer (-1)", parallely . maxBuffer (-1))]
749+ <> [("rate AvgRate 0.00000001", parallely . avgRate 0.00000001)]
750+ <> [("maxBuffer (-1)", parallely . maxBuffer (-1))]
762751#endif
763752 let zipSerialOps :: IsStream t => ((ZipSerialM IO a -> t IO a) -> Spec) -> Spec
764753 zipSerialOps spec = mapOps spec $ makeOps zipSerially
765754#ifndef COVERAGE_BUILD
766− ++ [("rate AvgRate 0.00000001", zipSerially . avgRate 0.00000001)]
767− ++ [("maxBuffer (-1)", zipSerially . maxBuffer (-1))]
755+ <> [("rate AvgRate 0.00000001", zipSerially . avgRate 0.00000001)]
756+ <> [("maxBuffer (-1)", zipSerially . maxBuffer (-1))]
768757#endif
769758 -- Note, the "pure" of applicative Zip streams generates and infinite
770759 -- stream and therefore maxBuffer (-1) must not be used for that case.
@@ -943,9 +932,9 @@ main = hspec
943932 aheadOps $ prop "ahead" . concurrentApplication (==)
944933 parallelOps $ prop "parallel" . concurrentApplication sortEq
945934
946− prop "concurrent foldr application" $ withMaxSuccess maxTestCount $
935+ prop "concurrent foldr application" $ withMaxSuccess maxTestCount
947936 concurrentFoldrApplication
948− prop "concurrent foldl application" $ withMaxSuccess maxTestCount $
937+ prop "concurrent foldl application" $ withMaxSuccess maxTestCount
949938 concurrentFoldlApplication
950939
951940 -- These tests are specifically targeted towards detecting illegal sharing