on master help sign in
fix hlint warnings
df553b1Harendra Kumar
.hlint.ignore−4
@@ -17,7 +17,6 @@ src/Streamly/Internal/Data/Stream/StreamD.hs
17src/Streamly/Internal/Data/SmallArray.hs
17src/Streamly/Internal/Data/SmallArray.hs
18src/Streamly/Internal/Data/Pipe/Types.hs
18src/Streamly/Internal/Data/Pipe/Types.hs
19src/Streamly/Internal/Data/Pipe.hs
19src/Streamly/Internal/Data/Pipe.hs
20−src/Streamly/Internal/Data/Array.hs
21src/Streamly/Internal/Data/Sink/Types.hs
20src/Streamly/Internal/Data/Sink/Types.hs
22src/Streamly/Internal/Data/Sink.hs
21src/Streamly/Internal/Data/Sink.hs
23src/Streamly/Internal/Data/Zipper/Array.hs
22src/Streamly/Internal/Data/Zipper/Array.hs
@@ -26,13 +25,10 @@ src/Streamly/Internal/Data/Parser/ParserD.hs
26src/Streamly/Internal/Data/Time/Units.hs
25src/Streamly/Internal/Data/Time/Units.hs
27src/Streamly/Internal/Data/Prim/Array.hs
26src/Streamly/Internal/Data/Prim/Array.hs
28src/Streamly/Internal/Data/Prim/Array/Types.hs
27src/Streamly/Internal/Data/Prim/Array/Types.hs
29−src/Streamly/Internal/Data/Fold/Types.hs
30−src/Streamly/Internal/Data/Fold.hs
31src/Streamly/Internal/Data/SmallArray/Types.hs
28src/Streamly/Internal/Data/SmallArray/Types.hs
32src/Streamly/Internal/Data/Unfold.hs
29src/Streamly/Internal/Data/Unfold.hs
33src/Streamly/Internal/Data/Unicode/Stream.hs
30src/Streamly/Internal/Data/Unicode/Stream.hs
34src/Streamly/Internal/Memory/Array/Types.hs
31src/Streamly/Internal/Memory/Array/Types.hs
35−src/Streamly/Internal/Prelude.hs
36src/Streamly/Internal/Mutable/Prim/Var.hs
32src/Streamly/Internal/Mutable/Prim/Var.hs
37src/Streamly/Internal/Network/Socket.hs
33src/Streamly/Internal/Network/Socket.hs
38src/Streamly/Internal/Data/Stream/Prelude.hs
34src/Streamly/Internal/Data/Stream/Prelude.hs
src/Streamly/Internal/Data/Fold.hs+9−11
@@ -215,10 +215,10 @@ import Data.Int (Int64)
215import Data.Map.Strict (Map)
215import Data.Map.Strict (Map)
216
216
217import Prelude
217import Prelude
218− hiding (filter, drop, dropWhile, take, takeWhile, zipWith, foldr,
218+ hiding (filter, drop, dropWhile, take, takeWhile, zipWith,
219 foldl, map, mapM_, sequence, all, any, sum, product, elem,
219 foldl, map, mapM_, sequence, all, any, sum, product, elem,
220 notElem, maximum, minimum, head, last, tail, length, null,
220 notElem, maximum, minimum, head, last, tail, length, null,
221− reverse, iterate, init, and, or, lookup, foldr1, (!!),
221+ reverse, iterate, init, and, or, lookup, (!!),
222 scanl, scanl1, replicate, concatMap, mconcat, foldMap, unzip,
222 scanl, scanl1, replicate, concatMap, mconcat, foldMap, unzip,
223 span, splitAt, break, mapM)
223 span, splitAt, break, mapM)
224
224
@@ -332,7 +332,7 @@ transform (Pipe pstep1 pstep2 pinitial) (Fold fstep finitial fextract) =
332
332
333 where
333 where
334
334
335− initial = Tuple' <$> return pinitial <*> finitial
335+ initial = Tuple' pinitial <$> finitial
336 step (Tuple' ps fs) x = do
336 step (Tuple' ps fs) x = do
337 r <- pstep1 ps x
337 r <- pstep1 ps x
338 go fs r
338 go fs r
@@ -929,7 +929,7 @@ splitAt
929splitAt n (Fold stepL initialL extractL) (Fold stepR initialR extractR) =
929splitAt n (Fold stepL initialL extractL) (Fold stepR initialR extractR) =
930 Fold step initial extract
930 Fold step initial extract
931 where
931 where
932− initial = Tuple3' <$> return n <*> initialL <*> initialR
932+ initial = Tuple3' n <$> initialL <*> initialR
933
933
934 step (Tuple3' i xL xR) input =
934 step (Tuple3' i xL xR) input =
935 if i > 0
935 if i > 0
@@ -1158,8 +1158,7 @@ foldCons (Fold stepL beginL doneL) (Fold stepR beginR doneR) =
1158-- @since 0.7.0
1158-- @since 0.7.0
1159{-# INLINE distribute #-}
1159{-# INLINE distribute #-}
1160distribute :: Monad m => [Fold m a b] -> Fold m a [b]
1160distribute :: Monad m => [Fold m a b] -> Fold m a [b]
1161−distribute [] = foldNil
1161+distribute = foldr foldCons foldNil
1162−distribute (x:xs) = foldCons x (distribute xs)
1163
1162
1164-- | Like 'distribute' but for folds that return (), this can be more efficient
1163-- | Like 'distribute' but for folds that return (), this can be more efficient
1165-- than 'distribute' as it does not need to maintain state.
1164-- than 'distribute' as it does not need to maintain state.
@@ -1173,9 +1172,8 @@ distribute_ fs = Fold step initial extract
1173 step ss a = do
1172 step ss a = do
1174 Prelude.mapM_ (\(Fold s i _) -> i >>= \r -> void (s r a)) ss
1173 Prelude.mapM_ (\(Fold s i _) -> i >>= \r -> void (s r a)) ss
1175 return ss
1174 return ss
1176− extract ss = do
1175+ extract ss =
1177 Prelude.mapM_ (\(Fold _ i e) -> i >>= \r -> e r) ss
1176 Prelude.mapM_ (\(Fold _ i e) -> i >>= \r -> e r) ss
1178− return ()
1179
1177
1180------------------------------------------------------------------------------
1178------------------------------------------------------------------------------
1181-- Partitioning
1179-- Partitioning
@@ -1235,7 +1233,7 @@ partitionByM f (Fold stepL beginL doneL) (Fold stepR beginR doneR) =
1235 r <- f a
1233 r <- f a
1236 case r of
1234 case r of
1237 Left b -> Tuple' <$> stepL xL b <*> return xR
1235 Left b -> Tuple' <$> stepL xL b <*> return xR
1238− Right c -> Tuple' <$> return xL <*> stepR xR c
1236+ Right c -> Tuple' xL <$> stepR xR c
1239 done (Tuple' xL xR) = (,) <$> doneL xL <*> doneR xR
1237 done (Tuple' xL xR) = (,) <$> doneL xL <*> doneR xR
1240
1238
1241-- Note: we could use (a -> Bool) instead of (a -> Either b c), but the latter
1239-- Note: we could use (a -> Bool) instead of (a -> Either b c), but the latter
@@ -1369,8 +1367,8 @@ demuxWithDefault_ f kv (Fold dstep dinitial dextract) =
1369 initFold (Fold s i e) = i >>= \r -> return (Fold s (return r) e)
1367 initFold (Fold s i e) = i >>= \r -> return (Fold s (return r) e)
1370 initial = do
1368 initial = do
1371 mp <- Prelude.mapM initFold kv
1369 mp <- Prelude.mapM initFold kv
1372− dacc <- dinitial
1373− return (Tuple' mp dacc)
1370+ Tuple' mp <$> dinitial
1371+
1374 step (Tuple' mp dacc) a
1372 step (Tuple' mp dacc) a
1375 | (k, a') <- f a
1373 | (k, a') <- f a
1376 = case Map.lookup k mp of
1374 = case Map.lookup k mp of
src/Streamly/Internal/Network/Inet/TCP.hs+1−1
@@ -252,7 +252,7 @@ connectionsOnLocalHost = connectionsOnAddr (127,0,0,1)
252connect :: (Word8, Word8, Word8, Word8) -> PortNumber -> IO Socket
252connect :: (Word8, Word8, Word8, Word8) -> PortNumber -> IO Socket
253connect addr port = do
253connect addr port = do
254 sock <- socket AF_INET Stream defaultProtocol
254 sock <- socket AF_INET Stream defaultProtocol
255− (Net.connect sock $ SockAddrInet port (Net.tupleToHostAddress addr))
255+ Net.connect sock (SockAddrInet port (Net.tupleToHostAddress addr))
256 `onException` Net.close sock
256 `onException` Net.close sock
257 return sock
257 return sock
258
258
src/Streamly/Internal/Prelude.hs+1−1
@@ -3207,7 +3207,7 @@ parseIterate
3207 -> t m a
3207 -> t m a
3208 -> t m b
3208 -> t m b
3209parseIterate f i m = D.fromStreamD $
3209parseIterate f i m = D.fromStreamD $
3210− D.parseIterate (\b -> PRD.fromParserK $ f b) i (D.toStreamD m)
3210+ D.parseIterate (PRD.fromParserK . f) i (D.toStreamD m)
3211
3211
3212------------------------------------------------------------------------------
3212------------------------------------------------------------------------------
3213-- Grouping/Splitting
3213-- Grouping/Splitting