@@ -2,7 +2,8 @@
3module Main (main) where
3module Main (main) where
5−import Data.List (sort)
5+import Data.List (sort, sortBy)
6+import Data.Ord (comparing, Down(..))
6import Data.Semigroup (Sum(..), getSum)
7import Data.Semigroup (Sum(..), getSum)
7import Streamly.Test.Common (checkListEqual, listEquals)
8import Streamly.Test.Common (checkListEqual, listEquals)
8import Test.QuickCheck
9import Test.QuickCheck
@@ -412,7 +413,7 @@ partitionByM =
414 action ls = do
415 action ls = do
415− let f = \x -> if odd x then return (Left x) else return (Right x)
416+ let f x = if odd x then return (Left x) else return (Right x)
418 $ Stream.fold (Fold.partitionByM f Fold.length Fold.length)
419 $ Stream.fold (Fold.partitionByM f Fold.length Fold.length)
@@ -429,7 +430,7 @@ partitionByFstM =
431 action _ = do
432 action _ = do
432− let f = \x -> if odd x then return (Left x) else return (Right x)
433+ let f x = if odd x then return (Left x) else return (Right x)
435 $ Stream.fold
436 $ Stream.fold
@@ -447,7 +448,7 @@ partitionByMinM1 =
449 action _ = do
450 action _ = do
450− let f = \x -> if odd x then return (Left x) else return (Right x)
451+ let f x = if odd x then return (Left x) else return (Right x)
453 $ Stream.fold
454 $ Stream.fold
@@ -465,7 +466,7 @@ partitionByMinM2 =
467 action _ = do
468 action _ = do
468− let f = \x -> if odd x then return (Left x) else return (Right x)
469+ let f x = if odd x then return (Left x) else return (Right x)
471 $ Stream.fold
472 $ Stream.fold
@@ -690,7 +691,7 @@ topBy isTop = forAll (listOf (chooseInt (-50, 100))) $ \ls0 ->
692 lst <- Stream.fold (Fold.top n) (Stream.fromList ls) >>= MArray.toList
693 lst <- Stream.fold (Fold.top n) (Stream.fromList ls) >>= MArray.toList
693− assert ((Prelude.take n . Prelude.reverse . sort) ls == lst)
694+ assert ((Prelude.take n . sortBy (comparing Down)) ls == lst)
695 lst <- Stream.fold (Fold.bottom n) (Stream.fromList ls) >>= MArray.toList
696 lst <- Stream.fold (Fold.bottom n) (Stream.fromList ls) >>= MArray.toList
696 assert ((Prelude.take n . sort) ls == lst)
697 assert ((Prelude.take n . sort) ls == lst)