@@ -2,7 +2,8 @@
22
33module Main (main) where
44
5−import Data.List (sort)
5+import Data.List (sort, sortBy)
6+import Data.Ord (comparing, Down(..))
67import Data.Semigroup (Sum(..), getSum)
78import Streamly.Test.Common (checkListEqual, listEquals)
89import Test.QuickCheck
@@ -412,7 +413,7 @@ partitionByM =
412413 where
413414
414415 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)
416417 v1 <-
417418 run
418419 $ Stream.fold (Fold.partitionByM f Fold.length Fold.length)
@@ -429,7 +430,7 @@ partitionByFstM =
429430 where
430431
431432 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)
433434 v1 <-
434435 run
435436 $ Stream.fold
@@ -447,7 +448,7 @@ partitionByMinM1 =
447448 where
448449
449450 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)
451452 v1 <-
452453 run
453454 $ Stream.fold
@@ -465,7 +466,7 @@ partitionByMinM2 =
465466 where
466467
467468 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)
469470 v1 <-
470471 run
471472 $ Stream.fold
@@ -690,7 +691,7 @@ topBy isTop = forAll (listOf (chooseInt (-50, 100))) $ \ls0 ->
690691 if isTop
691692 then do
692693 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)
694695 else do
695696 lst <- Stream.fold (Fold.bottom n) (Stream.fromList ls) >>= MArray.toList
696697 assert ((Prelude.take n . sort) ls == lst)