on 43dda21 help sign in
772 lines 22 kB history raw
1module Main (main) where
3import Data.List (sort)
4import Data.Semigroup (Sum(..), getSum)
5import Streamly.Test.Common (checkListEqual, listEquals)
6import Test.QuickCheck
7 ( Gen
8 , Property
9 , arbitrary
10 , choose
11 , forAll
12 , listOf
13 , listOf1
14 , property
15 , vectorOf
16 , withMaxSuccess
17 , generate
18 )
19import Control.Monad.IO.Class (liftIO)
20import Test.QuickCheck.Monadic (monadicIO, assert, run)
22import qualified Data.Map
23import qualified Prelude
24import qualified Streamly.Internal.Data.Fold as F
25import qualified Streamly.Prelude as S
26import qualified Streamly.Internal.Data.Array.Foreign.Mut.Type as MA
27import qualified Streamly.Internal.Data.Stream.IsStream as Stream
28import qualified Streamly.Data.Fold as FL
30import Prelude hiding
31 (maximum, minimum, elem, notElem, null, product, sum, head, last, take)
32import Test.Hspec as H
33import Test.Hspec.QuickCheck
35maxStreamLen :: Int
36maxStreamLen = 1000
38intMin :: Int
39intMin = minBound
41intMax :: Int
42intMax = maxBound
44min_value :: Int
45min_value = 0
47max_value :: Int
48max_value = 10000
50chooseInt :: (Int, Int) -> Gen Int
51chooseInt = choose
53{-# INLINE maxStreamLen #-}
54{-# INLINE intMin #-}
55{-# INLINE intMax #-}
57rollingHashFirstN :: Property
58rollingHashFirstN =
59 forAll (choose (0, maxStreamLen)) $ \len ->
60 forAll (choose (0, len)) $ \n ->
61 forAll (vectorOf len (arbitrary :: Gen Int)) $ \vec ->
62 monadicIO $ do
63 a <- run $ S.fold F.rollingHash $ S.take n $ S.fromList vec
64 b <- run $ S.fold (F.rollingHashFirstN n) $ S.fromList vec
65 assert $ a == b
67head :: [Int] -> Expectation
68head ls = S.fold FL.head (S.fromList ls) `shouldReturn` headl ls
70headl :: [a] -> Maybe a
71headl [] = Nothing
72headl (x:_) = Just x
74length :: [Int] -> Expectation
75length ls = S.fold FL.length (S.fromList ls) `shouldReturn` Prelude.length ls
77sum :: [Int] -> Expectation
78sum ls = S.fold FL.sum (S.fromList ls) `shouldReturn` Prelude.sum ls
80product :: [Int] -> Expectation
81product ls =
82 S.fold FL.product (S.fromList ls) `shouldReturn` Prelude.product ls
84lesser :: (a -> a -> Ordering) -> a -> a -> a
85lesser f x y = if f x y == LT then x else y
87greater :: (a -> a -> Ordering) -> a -> a -> a
88greater f x y = if f x y == GT then x else y
90foldMaybe :: (b -> a -> b) -> b -> [a] -> Maybe b
91foldMaybe f acc ls =
92 case ls of
93 [] -> Nothing
94 _ -> Just (foldl f acc ls)
96maximumBy :: (Ord a, Show a) => a -> (a -> a -> Ordering) -> [a] -> Expectation
97maximumBy genmin f ls =
98 S.fold (FL.maximumBy f) (S.fromList ls)
99 `shouldReturn` foldMaybe (greater f) genmin ls
101maximum :: (Show a, Ord a) => a -> [a] -> Expectation
102maximum genmin ls =
103 S.fold FL.maximum (S.fromList ls)
104 `shouldReturn` foldMaybe (greater compare) genmin ls
106minimumBy :: (Ord a, Show a) => a -> (a -> a -> Ordering) -> [a] -> Expectation
107minimumBy genmax f ls =
108 S.fold (FL.minimumBy f) (S.fromList ls)
109 `shouldReturn` foldMaybe (lesser f) genmax ls
111minimum :: (Show a, Ord a) => a -> [a] -> Expectation
112minimum genmax ls =
113 S.fold FL.minimum (S.fromList ls)
114 `shouldReturn` foldMaybe (lesser compare) genmax ls
116toList :: [Int] -> Expectation
117toList ls = S.fold FL.toList (S.fromList ls) `shouldReturn` ls
119toListRev :: [Int] -> Expectation
120toListRev ls = S.fold FL.toListRev (S.fromList ls) `shouldReturn` reverse ls
122safeLast :: [a] -> Maybe a
123safeLast [] = Nothing
124safeLast (x:[]) = Just x
125safeLast (_:xs) = safeLast xs
127last :: [String] -> Expectation
128last ls = S.fold FL.last (S.fromList ls) `shouldReturn` safeLast ls
130mapMaybe :: [Int] -> Expectation
131mapMaybe ls =
132 let maybeEven x =
133 if even x
134 then Just x
135 else Nothing
136 f = FL.mapMaybe maybeEven FL.toList
137 in S.fold f (S.fromList ls) `shouldReturn` filter even ls
139nth :: Int -> [a] -> Maybe a
140nth idx (x : xs)
141 | idx == 0 = Just x
142 | idx < 0 = Nothing
143 | otherwise = nth (idx - 1) xs
144nth _ [] = Nothing
146index :: Int -> [String] -> Expectation
147index idx ls =
148 let x = S.fold (FL.index idx) (S.fromList ls)
149 in x `shouldReturn` nth idx ls
151find :: (Show a, Eq a) => (a -> Bool) -> [a] -> Expectation
152find f ls = do
153 y <- S.fold (FL.findIndex f) (S.fromList ls)
154 case y of
155 Nothing ->
156 let fld = S.fold (FL.find f) (S.fromList ls)
157 in fld `shouldReturn` Nothing
158 Just idx ->
159 let fld = S.fold (FL.any f) (S.fromList $ Prelude.take idx ls)
160 in fld `shouldReturn` False
162neg :: (a -> Bool) -> a -> Bool
163neg f x = not (f x)
165findIndex :: (a -> Bool) -> [a] -> Expectation
166findIndex f ls = do
167 y <- S.fold (FL.findIndex f) (S.fromList ls)
168 case y of
169 Nothing ->
170 let fld = S.fold (FL.all $ neg f) (S.fromList ls)
171 in fld `shouldReturn` True
172 Just idx ->
173 if idx == 0
174 then
175 S.fold (FL.all f) (S.fromList []) `shouldReturn` True
176 else
177 S.fold (FL.all f) (S.fromList $ Prelude.take idx ls)
178 `shouldReturn` False
180predicate :: Int -> Bool
181predicate x = x * x < 100
183elemIndex :: Int -> [Int] -> Expectation
184elemIndex elm ls = do
185 y <- S.fold (FL.elemIndex elm) (S.fromList ls)
186 case y of
187 Nothing ->
188 let fld = S.fold (FL.any (== elm)) (S.fromList ls)
189 in fld `shouldReturn` False
190 Just idx ->
191 let fld =
192 S.fold (FL.any (== elm)) (S.fromList $ Prelude.take idx ls)
193 in fld `shouldReturn` False
195null :: [Int] -> Expectation
196null ls =
197 S.fold FL.null (S.fromList ls)
198 `shouldReturn`
199 case ls of
200 [] -> True
201 _ -> False
203elem :: Int -> [Int] -> Expectation
204elem elm ls = do
205 y <- S.fold (FL.elem elm) (S.fromList ls)
206 let fld = S.fold (FL.any (== elm)) (S.fromList ls)
207 fld `shouldReturn` y
209notElem :: Int -> [Int] -> Expectation
210notElem elm ls = do
211 y <- S.fold (FL.notElem elm) (S.fromList ls)
212 let fld = S.fold (FL.any (== elm)) (S.fromList ls)
213 fld `shouldReturn` not y
215all :: (a -> Bool) -> [a] -> Expectation
216all f ls =
217 S.fold (FL.all f) (S.fromList ls) `shouldReturn` Prelude.all f ls
219any :: (a -> Bool) -> [a] -> Expectation
220any f ls = S.fold (FL.any f) (S.fromList ls) `shouldReturn` Prelude.any f ls
222and :: [Bool] -> Expectation
223and ls = S.fold FL.and (S.fromList ls) `shouldReturn` Prelude.and ls
225or :: [Bool] -> Expectation
226or ls = S.fold FL.or (S.fromList ls) `shouldReturn` Prelude.or ls
228take :: [Int] -> Property
229take ls =
230 forAll (chooseInt (-1, Prelude.length ls + 2)) $ \n ->
231 S.fold (FL.take n FL.toList) (S.fromList ls)
232 `shouldReturn` Prelude.take n ls
234takeEndBy_ :: Property
235takeEndBy_ =
236 forAll (listOf (chooseInt (0, 1))) $ \ls ->
237 let p = (== 1)
238 f = FL.takeEndBy_ p FL.toList
239 ys = Prelude.takeWhile (not . p) ls
240 in case S.fold f (S.fromList ls) of
241 Right xs -> checkListEqual xs ys
242 Left _ -> property False
244takeEndByOrMax :: Property
245takeEndByOrMax =
246 forAll (chooseInt (min_value, max_value)) $ \n ->
247 forAll (listOf (chooseInt (0, 1))) $ \ls ->
248 let p = (== 1)
249 f = FL.takeEndBy_ p (FL.take n FL.toList)
250 ys = Prelude.take n (Prelude.takeWhile (not . p) ls)
251 in case S.fold f (S.fromList ls) of
252 Right xs -> checkListEqual xs ys
253 Left _ -> property False
255chooseFloat :: (Float, Float) -> Gen Float
256chooseFloat = choose
258drain :: [Int] -> Expectation
259drain ls = S.fold FL.drain (S.fromList ls) `shouldReturn` ()
261drainBy :: [Int] -> Expectation
262drainBy ls = S.fold (FL.drainBy return) (S.fromList ls) `shouldReturn` ()
264mean :: Property
265mean =
266 forAll (listOf1 (chooseFloat (-100.0, 100.0)))
267 $ \ls0 -> withMaxSuccess 1000 $ monadicIO $ action ls0
269 where
271 action ls = do
272 v1 <- run $ S.fold FL.mean (S.fromList ls)
273 let v2 = Prelude.sum ls / fromIntegral (Prelude.length ls)
274 assert (abs (v1 - v2) < 0.0001)
276stdDev :: Property
277stdDev =
278 forAll (listOf1 (chooseFloat (-100.0, 100.0)))
279 $ \ls0 -> withMaxSuccess 1000 $ monadicIO $ action ls0
281 where
283 action ls = do
284 v1 <- run $ S.fold FL.stdDev (S.fromList ls)
285 let avg = Prelude.sum ls / fromIntegral (Prelude.length ls)
286 se = Prelude.sum (fmap (\x -> (x - avg) * (x - avg)) ls)
287 sd = sqrt $ se / fromIntegral (Prelude.length ls)
288 assert (abs (v1 - sd) < 0.0001 )
290variance :: Property
291variance =
292 forAll (listOf1 (chooseFloat (-100.0, 100.0)))
293 $ \ls0 -> withMaxSuccess 1000 $ monadicIO $ action ls0
295 where
297 action ls = do
298 v1 <- run $ S.fold FL.variance (S.fromList ls)
299 let avg = Prelude.sum ls / fromIntegral (Prelude.length ls)
300 se = Prelude.sum (fmap (\x -> (x - avg) * (x - avg)) ls)
301 vr = se / fromIntegral (Prelude.length ls)
302 assert (abs (v1 - vr) < 0.01 )
304mconcat :: Property
305mconcat =
306 forAll (listOf1 (chooseInt (intMin, intMax)))
307 $ \ls0 -> monadicIO $ action ls0
309 where
311 action ls = do
312 v1 <- run $ S.fold FL.mconcat (S.map Sum $ S.fromList ls)
313 let v2 = Prelude.sum ls
314 assert (getSum v1 == v2)
316foldMap :: Property
317foldMap =
318 forAll (listOf1 (chooseInt (intMin, intMax)))
319 $ \ls0 -> monadicIO $ action ls0
321 where
323 action ls = do
324 v1 <- run $ S.fold (FL.foldMap Sum) $ S.fromList ls
325 let v2 = Prelude.sum ls
326 assert (getSum v1 == v2)
328foldMapM :: Property
329foldMapM =
330 forAll (listOf1 (chooseInt (intMin, intMax)))
331 $ \ls0 -> monadicIO $ action ls0
333 where
335 action ls = do
336 v1 <- run $ S.fold (FL.foldMapM (return . Sum)) $ S.fromList ls
337 let v2 = Prelude.sum ls
338 assert (getSum v1 == v2)
340lookup :: Property
341lookup =
342 forAll (chooseInt (1, 15))
343 $ \key0 ->monadicIO $ action key0
345 where
347 action key = do
348 let ls = [ (1, "first"), (2, "second"), (3, "third"), (4, "fourth")
349 , (5, "fifth"), (6, "fifth+first"), (7, "fifth+second")
350 , (8, "fifth+third"), (9, "fifth+fourth")
351 , (10, "fifth+fifth")
352 ]
353 v1 <- run $ S.fold (FL.lookup key) $ S.fromList ls
354 let v2 = Prelude.lookup key ls
355 assert (v1 == v2)
357rmapM :: Property
358rmapM =
359 forAll (listOf1 (chooseInt (intMin, intMax)))
360 $ \ls0 -> monadicIO $ action ls0
362 where
364 action ls = do
365 let addLen x = return $ x + Prelude.length ls
366 fld = FL.rmapM addLen FL.sum
367 v2 = foldl (+) (Prelude.length ls) ls
368 v1 <- run $ S.fold fld $ S.fromList ls
369 assert (v1 == v2)
371teeWithLength :: Property
372teeWithLength =
373 forAll (listOf1 (chooseInt (intMin, intMax)))
374 $ \ls0 -> monadicIO $ action ls0
376 where
378 action ls = do
379 v1 <- run $ S.fold (FL.tee FL.sum FL.length) $ S.fromList ls
380 let v2 = Prelude.sum ls
381 v3 = Prelude.length ls
382 assert (v1 == (v2, v3))
384teeWithFstLength :: Property
385teeWithFstLength =
386 forAll (listOf1 (chooseInt (intMin, intMax)))
387 $ \ls0 -> monadicIO $ action ls0
389 where
391 action ls = do
392 v1 <- run $ S.fold (F.teeWithFst (,) (FL.take 5 FL.sum) FL.length) $ S.fromList ls
393 let v2 = Prelude.sum (Prelude.take 5 ls)
394 v3 = Prelude.length (Prelude.take 5 ls)
395 assert (v1 == (v2, v3))
397partitionByM :: Property
398partitionByM =
399 forAll (listOf1 (chooseInt (intMin, intMax)))
400 $ \ls0 -> monadicIO $ action ls0
402 where
404 action ls = do
405 let f = \x -> if odd x then return (Left x) else return (Right x)
406 v1 <- run $ S.fold (F.partitionByM f FL.length FL.length) $ S.fromList ls
407 let v2 = foldl (\b a -> if odd a then b+1 else b) 0 ls
408 v3 = foldl (\b a -> if even a then b+1 else b) 0 ls
409 assert (v1 == (v2, v3))
411partitionByFstM :: Property
412partitionByFstM =
413 forAll (listOf1 (chooseInt (intMin, intMax)))
414 $ \ls0 -> monadicIO $ action ls0
416 where
418 action _ = do
419 let f = \x -> if odd x then return (Left x) else return (Right x)
420 v1 <- run $ S.fold (F.partitionByFstM f (FL.take 25 FL.length) FL.length) (S.fromList ([1..100]:: [Int]))
421 let v2 = foldl (\b a -> if odd a then b+1 else b) 0 ([1..49] :: [Int])
422 v3 = foldl (\b a -> if even a then b+1 else b) 0 ([1..49] :: [Int])
423 assert (v1 == (v2, v3))
425partitionByMinM1 :: Property
426partitionByMinM1 =
427 forAll (listOf1 (chooseInt (intMin, intMax)))
428 $ \ls0 -> monadicIO $ action ls0
430 where
432 action _ = do
433 let f = \x -> if odd x then return (Left x) else return (Right x)
434 v1 <- run $ S.fold (F.partitionByMinM f FL.length (FL.take 25 FL.length)) (S.fromList ([1..100]:: [Int]))
435 let v2 = foldl (\b a -> if odd a then b+1 else b) 0 ([1..50] :: [Int])
436 v3 = foldl (\b a -> if even a then b+1 else b) 0 ([1..50] :: [Int])
437 assert (v1 == (v2, v3))
439partitionByMinM2 :: Property
440partitionByMinM2 =
441 forAll (listOf1 (chooseInt (intMin, intMax)))
442 $ \ls0 -> monadicIO $ action ls0
444 where
446 action _ = do
447 let f = \x -> if odd x then return (Left x) else return (Right x)
448 v1 <- run $ S.fold (F.partitionByMinM f (FL.take 25 FL.length) FL.length) (S.fromList ([1..100]:: [Int]))
449 let v2 = foldl (\b a -> if odd a then b+1 else b) 0 ([1..49] :: [Int])
450 v3 = foldl (\b a -> if even a then b+1 else b) 0 ([1..49] :: [Int])
451 assert (v1 == (v2, v3))
453teeWithMinLength1 :: Property
454teeWithMinLength1 =
455 forAll (listOf1 (chooseInt (intMin, intMax)))
456 $ \ls0 -> monadicIO $ action ls0
458 where
460 action ls = do
461 v1 <- run $ S.fold (F.teeWithMin (,) (FL.take 5 FL.sum) FL.length) $ S.fromList ls
462 let v2 = Prelude.sum (Prelude.take 5 ls)
463 v3 = Prelude.length (Prelude.take 5 ls)
464 assert (v1 == (v2, v3))
467teeWithMinLength2 :: Property
468teeWithMinLength2 =
469 forAll (listOf1 (chooseInt (intMin, intMax)))
470 $ \ls0 -> monadicIO $ action ls0
472 where
474 action ls = do
475 v1 <- run $ S.fold (F.teeWithMin (,) FL.sum (FL.take 5 FL.length)) $ S.fromList ls
476 let v2 = Prelude.sum (Prelude.take 5 ls)
477 v3 = Prelude.length (Prelude.take 5 ls)
478 assert (v1 == (v2, v3))
479teeWithMax :: Property
480teeWithMax =
481 forAll (listOf1 (chooseInt (intMin, intMax)))
482 $ \ls0 -> monadicIO $ action ls0
484 where
486 action ls = do
487 v1 <- run $ S.fold (FL.tee FL.sum FL.maximum) $ S.fromList ls
488 let v2 = Prelude.sum ls
489 v3 = foldMaybe (greater compare) intMin ls
490 assert (v1 == (v2, v3))
492distribute :: Property
493distribute =
494 forAll (listOf1 (chooseInt (intMin, intMax)))
495 $ \ls0 -> monadicIO $ action ls0
497 where
499 action ls = do
500 v1 <- run $ S.fold (FL.distribute [FL.sum, FL.length]) $ S.fromList ls
501 let v2 = Prelude.sum ls
502 v3 = Prelude.length ls
503 assert (v1 == [v2, v3])
505partition :: Property
506partition =
507 monadicIO $ do
508 v1 :: (Int, [String]) <-
509 run
510 $ S.fold (FL.partition FL.sum FL.toList)
511 $ S.fromList
512 [Left 1, Right "abc", Left 3, Right "xy", Right "pp2"]
513 let v2 = (4,["abc","xy","pp2"])
514 assert (v1 == v2)
516unzip :: Property
517unzip =
518 monadicIO $ do
519 v1 :: (Int, [String]) <-
520 run
521 $ S.fold (FL.unzip FL.sum FL.toList)
522 $ S.fromList [(1, "aa"), (2, "bb"), (3, "cc")]
523 let v2 = (6, ["aa", "bb", "cc"])
524 assert (v1 == v2)
526postscan :: Property
527postscan = forAll (listOf (chooseInt (intMin, intMax))) $ \ls ->
528 monadicIO $ do
529 v1 :: [Int] <-
530 run
531 $ S.fold (F.postscan FL.sum FL.toList)
532 $ S.fromList ls
533 let v2 = scanl1 (+) ls
534 assert (v1 == v2)
536many :: Property
537many =
538 forAll (listOf (chooseInt (0, 100))) $ \lst ->
539 forAll (chooseInt (1, 100)) $ \i ->
540 monadicIO $ do
541 let strm = S.fromList lst
542 r1 <- S.fold (FL.many (split i) FL.toList) strm
543 r2 <- S.toList $ Stream.foldMany (split i) strm
544 assert $ r1 == r2
546 where
548 split i = FL.take i FL.toList
550headAndRest :: [Int] -> Property
551headAndRest ls = monadicIO $ do
552 (mbh, rest) <- run $ Stream.fold_ FL.head (S.fromList ls)
553 rests <- run $ S.toList rest
554 assert (mbh == headl ls)
555 listEquals (==) rests (taill ls)
557 where
559 taill :: [a] -> [a]
560 taill [] = []
561 taill (_:xs) = xs
563demux :: Expectation
564demux =
565 let table "SUM" = return FL.sum
566 table "PRODUCT" = return FL.product
567 table _ = return FL.length
568 input = Stream.fromList (
569 [ ("SUM", 1)
570 , ("abc", 1)
571 , ("PRODUCT", 2)
572 , ("abc", 2)
573 , ("SUM",3)
574 , ("xyz", 1)
575 , ("PRODUCT", 4)
576 , ("xyz", 2)
577 , ("abc", 2)
578 ] :: [(String, Int)])
579 in Stream.fold
580 (F.demux table)
581 input
582 `shouldReturn`
583 Data.Map.fromList [("PRODUCT", 8),("SUM", 4),("abc",3),("xyz",2)]
586demuxWith :: Expectation
587demuxWith =
588 let getKey x | even x = "SUM"
589 | otherwise = "PRODUCT"
591 getFold "SUM" = return FL.sum
592 getFold "PRODUCT" = return FL.product
593 getFold _ = error "demuxWith: bug"
595 input = Stream.fromList [1, 2, 3, 4 :: Int]
596 in Stream.fold
597 (F.demuxWith getKey (getFold . getKey))
598 input
599 `shouldReturn`
600 Data.Map.fromList [("PRODUCT",3),("SUM",6)]
602classifyWith :: Expectation
603classifyWith =
604 let input = Stream.fromList [("ONE",1),("ONE",1.1),("TWO",2), ("TWO",2.2)]
605 in Stream.fold
606 (F.classifyWith fst (FL.lmap snd FL.toList))
607 input
608 `shouldReturn`
609 Data.Map.fromList
610 [("ONE",[1.0, 1.1 :: Double]), ("TWO",[2.0, 2.2])]
612classify :: Expectation
613classify =
614 let input =
615 Stream.fromList
616 [
617 ("ONE", (1::Int, 1))
618 , ("ONE", (1, 1.1:: Double))
619 , ("TWO", (2, 2))
620 , ("TWO",(2, 2.2))
621 ]
622 in Stream.fold
623 (F.classify (FL.lmap snd FL.toList))
624 input
625 `shouldReturn`
626 Data.Map.fromList
627 [("ONE",[1.0, 1.1 :: Double]), ("TWO",[2.0, 2.2])]
629splitAt :: Expectation
630splitAt =
631 Stream.fold
632 (F.splitAt 6 FL.toList FL.toList)
633 (Stream.fromList "Hello World!")
634 `shouldReturn`
635 ("Hello ","World!")
637scan :: Property
638scan = forAll (listOf (chooseInt (0, 100))) $ \lst ->
639 monadicIO $ do
640 v1 :: [Int] <-
641 run
642 $ S.fold (F.scan FL.sum FL.toList)
643 $ S.fromList lst
644 let v2 = scanl (+) 0 lst
645 assert (v1 == v2)
647topBy :: Bool -> Property
648topBy isTop = forAll (listOf (chooseInt (-50, 100))) $ \ls0 ->
649 monadicIO $ action ls0
651 where
653 action ls = do
655 let n0 = Prelude.length ls
656 n <- liftIO $ generate $ chooseInt (-2, n0 + 2)
657 if isTop
658 then do
659 lst <- S.fold (F.top n) (S.fromList ls) >>= MA.toList
660 assert ((Prelude.take n . Prelude.reverse . sort) ls == lst)
661 else do
662 lst <- S.fold (F.bottom n) (S.fromList ls) >>= MA.toList
663 assert ((Prelude.take n . sort) ls == lst)
665top :: Property
666top = topBy True
668bottom :: Property
669bottom = topBy False
671moduleName :: String
672moduleName = "Data.Fold"
674main :: IO ()
675main = hspec $ do
676 describe moduleName $ do
677 -- Folds
678 -- Accumulators
679 prop "mconcat" Main.mconcat
680 prop "foldMap" Main.foldMap
681 prop "foldMapM" Main.foldMapM
683 prop "drain" Main.drain
684 prop "drainBy" Main.drainBy
685 prop "last" last
686 prop "length" Main.length
687 prop "sum" sum
688 prop "product" product
689 prop "maximumBy" $ maximumBy intMin compare
690 prop "maximum" $ maximum intMin
691 prop "minimumBy" $ minimumBy intMax compare
692 prop "minimum" $ minimum intMax
693 prop "mean" Main.mean
694 prop "stdDev" Main.stdDev
695 prop "variance" Main.variance
696 prop "rollingHashFirstN" rollingHashFirstN
698 prop "toList" toList
699 prop "toListRev" toListRev
700 prop "demux" demux
701 prop "demuxWith" demuxWith
702 prop "classifyWith" classifyWith
703 prop "classify" classify
705 -- Terminating folds
706 prop "index" index
707 prop "head" head
708 prop "find" $ find predicate
709 prop "lookup" Main.lookup
710 prop "findIndex" $ findIndex predicate
711 prop "elemIndex" $ elemIndex 10
712 prop "null" null
713 prop "elem" $ elem 10
714 prop "notElem" $ notElem 10
715 prop "all" $ Main.all predicate
716 prop "any" $ Main.any predicate
717 prop "and" Main.and
718 prop "or" Main.or
719 prop "top" Main.top
720 prop "bottom" Main.bottom
722 -- Combinators
724 -- Transformation
725 prop "scan" scan
726 prop "postscan" Main.postscan
727 -- rsequence
728 -- Functor instance
729 prop "rmapM" Main.rmapM
730 -- lmap/lmapM
732 -- Filtering
733 -- filter/filterM
734 -- catMaybes
735 prop "mapMaybe" mapMaybe
737 -- Trimming
738 prop "take" take
739 -- takeEndBy
740 prop "takeEndBy_" takeEndBy_
741 prop "takeEndByOrMax" takeEndByOrMax
743 -- Appending
744 -- serialWith
746 -- Distributing
747 -- tee
748 prop "teeWithLength" Main.teeWithLength
749 prop "teeWithFstLength" Main.teeWithFstLength
750 prop "teeWithMinLength1" Main.teeWithMinLength1
751 prop "teeWithMinLength2" Main.teeWithMinLength2
752 prop "teeWithMax" Main.teeWithMax
753 prop "partitionByM" Main.partitionByM
754 prop "partitionByFstM" Main.partitionByFstM
755 prop "partitionByMinM1" Main.partitionByMinM1
756 prop "partitionByMinM2" Main.partitionByMinM2
757 prop "distribute" Main.distribute
759 -- Partitioning
760 prop "partition" Main.partition
761 prop "partitionByM" partitionByM
763 -- Unzipping
764 prop "unzip" Main.unzip
765 prop "splitAt" Main.splitAt
767 -- Nesting
768 prop "many" Main.many
769 -- concatMap
770 -- chunksOf
772 prop "head from fold_" headAndRest