on master help sign in
Fix hlint issues in tests
ce86302Harendra Kumar
.hlint.ignore+1
@@ -13,6 +13,7 @@ test/Streamly/Test/Data/Unfold.hs
13test/Streamly/Test/FileSystem/Event.hs
13test/Streamly/Test/FileSystem/Event.hs
14test/Streamly/Test/Prelude/Concurrent.hs
14test/Streamly/Test/Prelude/Concurrent.hs
15test/Streamly/Test/Data/Stream/Concurrent.hs
15test/Streamly/Test/Data/Stream/Concurrent.hs
16+test/lib/Streamly/Test/Prelude/Common.hs
16test/Streamly/Test/Prelude/Fold.hs
17test/Streamly/Test/Prelude/Fold.hs
17test/Streamly/Test/Prelude/Rate.hs
18test/Streamly/Test/Prelude/Rate.hs
18test/Streamly/Test/Prelude/Serial.hs
19test/Streamly/Test/Prelude/Serial.hs
test/Streamly/Test/Data/Fold.hs+7−6
@@ -2,7 +2,8 @@
2
2
3module Main (main) where
3module Main (main) where
4
4
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 =
412 where
413 where
413
414
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)
416 v1 <-
417 v1 <-
417 run
418 run
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 =
429 where
430 where
430
431
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)
433 v1 <-
434 v1 <-
434 run
435 run
435 $ Stream.fold
436 $ Stream.fold
@@ -447,7 +448,7 @@ partitionByMinM1 =
447 where
448 where
448
449
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)
451 v1 <-
452 v1 <-
452 run
453 run
453 $ Stream.fold
454 $ Stream.fold
@@ -465,7 +466,7 @@ partitionByMinM2 =
465 where
466 where
466
467
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)
469 v1 <-
470 v1 <-
470 run
471 run
471 $ Stream.fold
472 $ Stream.fold
@@ -690,7 +691,7 @@ topBy isTop = forAll (listOf (chooseInt (-50, 100))) $ \ls0 ->
690 if isTop
691 if isTop
691 then do
692 then do
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)
694 else do
695 else do
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)
test/Streamly/Test/Data/Serialize/TH.hs+2−2
@@ -26,7 +26,7 @@ import Test.QuickCheck.Gen (oneof)
26genDatatype :: String -> Int -> Q [Dec]
26genDatatype :: String -> Int -> Q [Dec]
27genDatatype tyName numCons =
27genDatatype tyName numCons =
28 sequence
28 sequence
29− ([ dataD
29+ [ dataD
30 (pure [])
30 (pure [])
31 (mkName tyName)
31 (mkName tyName)
32 []
32 []
@@ -49,7 +49,7 @@ genDatatype tyName numCons =
49 []
49 []
50 ]
50 ]
51 ]
51 ]
52− ])
52+ ]
53
53
54 where
54 where
55
55
test/Streamly/Test/FileSystem/Handle.hs+2−2
@@ -75,7 +75,7 @@ readFromHandle =
75
75
76readWithBufferFromHandle :: IO (Stream IO Char)
76readWithBufferFromHandle :: IO (Stream IO Char)
77readWithBufferFromHandle =
77readWithBufferFromHandle =
78− let f1 = (\h -> (1024, h))
78+ let f1 h = (1024, h)
79 f2 = Unicode.decodeUtf8 . Stream.unfold Handle.readerWith . f1
79 f2 = Unicode.decodeUtf8 . Stream.unfold Handle.readerWith . f1
80 in executor f2
80 in executor f2
81
81
@@ -88,7 +88,7 @@ readChunksFromHandle =
88
88
89readChunksWithBuffer :: IO (Stream IO Char)
89readChunksWithBuffer :: IO (Stream IO Char)
90readChunksWithBuffer =
90readChunksWithBuffer =
91− let f1 = (\h -> (1024, h))
91+ let f1 h = (1024, h)
92 f2 =
92 f2 =
93 Unicode.decodeUtf8
93 Unicode.decodeUtf8
94 . Stream.concatMap Array.read
94 . Stream.concatMap Array.read
test/Streamly/Test/Unicode/Char.hs+1−1
@@ -54,7 +54,7 @@ checkEqual opName op (mc1, mc2) = do
54checkOp :: String -> NormalizationMode -> [(Text, Text)] -> IO Bool
54checkOp :: String -> NormalizationMode -> [(Text, Text)] -> IO Bool
55checkOp name op pairs = do
55checkOp name op pairs = do
56 res <- mapM (checkEqual name (normalize op)) pairs
56 res <- mapM (checkEqual name (normalize op)) pairs
57− return $ all (== True) res
57+ return $ and res
58
58
59checkNFC :: (Text, Text, Text, Text, Text) -> IO Bool
59checkNFC :: (Text, Text, Text, Text, Text) -> IO Bool
60checkNFC (c1, c2, c3, c4, c5) =
60checkNFC (c1, c2, c3, c4, c5) =