on master help sign in
fix hlint warnings

and remove fixed files from .hlint.ignore

commitdf553b1d5b653e5db0a4dba90823e1d25913ec52 authorHarendra Kumar <harendra@composewell.com> dateFri 15 May 2020, 10:09 (6 years ago) parentc9eff7e
4 files changed+11−17
.hlint.ignore−4 src/Streamly/Internal/Data/Fold.hs+9−11 src/Streamly/Internal/Network/Inet/TCP.hs+1−1 src/Streamly/Internal/Prelude.hs+1−1
.hlint.ignore−4
@@ -17,7 +17,6 @@ src/Streamly/Internal/Data/Stream/StreamD.hs
1717src/Streamly/Internal/Data/SmallArray.hs
1818src/Streamly/Internal/Data/Pipe/Types.hs
1919src/Streamly/Internal/Data/Pipe.hs
20−src/Streamly/Internal/Data/Array.hs
2120src/Streamly/Internal/Data/Sink/Types.hs
2221src/Streamly/Internal/Data/Sink.hs
2322src/Streamly/Internal/Data/Zipper/Array.hs
@@ -26,13 +25,10 @@ src/Streamly/Internal/Data/Parser/ParserD.hs
2625src/Streamly/Internal/Data/Time/Units.hs
2726src/Streamly/Internal/Data/Prim/Array.hs
2827src/Streamly/Internal/Data/Prim/Array/Types.hs
29−src/Streamly/Internal/Data/Fold/Types.hs
30−src/Streamly/Internal/Data/Fold.hs
3128src/Streamly/Internal/Data/SmallArray/Types.hs
3229src/Streamly/Internal/Data/Unfold.hs
3330src/Streamly/Internal/Data/Unicode/Stream.hs
3431src/Streamly/Internal/Memory/Array/Types.hs
35−src/Streamly/Internal/Prelude.hs
3632src/Streamly/Internal/Mutable/Prim/Var.hs
3733src/Streamly/Internal/Network/Socket.hs
3834src/Streamly/Internal/Data/Stream/Prelude.hs
src/Streamly/Internal/Data/Fold.hs+9−11
@@ -215,10 +215,10 @@ import Data.Int (Int64)
215215import Data.Map.Strict (Map)
216216
217217import Prelude
218− hiding (filter, drop, dropWhile, take, takeWhile, zipWith, foldr,
218+ hiding (filter, drop, dropWhile, take, takeWhile, zipWith,
219219 foldl, map, mapM_, sequence, all, any, sum, product, elem,
220220 notElem, maximum, minimum, head, last, tail, length, null,
221− reverse, iterate, init, and, or, lookup, foldr1, (!!),
221+ reverse, iterate, init, and, or, lookup, (!!),
222222 scanl, scanl1, replicate, concatMap, mconcat, foldMap, unzip,
223223 span, splitAt, break, mapM)
224224
@@ -332,7 +332,7 @@ transform (Pipe pstep1 pstep2 pinitial) (Fold fstep finitial fextract) =
332332
333333 where
334334
335− initial = Tuple' <$> return pinitial <*> finitial
335+ initial = Tuple' pinitial <$> finitial
336336 step (Tuple' ps fs) x = do
337337 r <- pstep1 ps x
338338 go fs r
@@ -929,7 +929,7 @@ splitAt
929929splitAt n (Fold stepL initialL extractL) (Fold stepR initialR extractR) =
930930 Fold step initial extract
931931 where
932− initial = Tuple3' <$> return n <*> initialL <*> initialR
932+ initial = Tuple3' n <$> initialL <*> initialR
933933
934934 step (Tuple3' i xL xR) input =
935935 if i > 0
@@ -1158,8 +1158,7 @@ foldCons (Fold stepL beginL doneL) (Fold stepR beginR doneR) =
11581158-- @since 0.7.0
11591159{-# INLINE distribute #-}
11601160distribute :: Monad m => [Fold m a b] -> Fold m a [b]
1161−distribute [] = foldNil
1162−distribute (x:xs) = foldCons x (distribute xs)
1161+distribute = foldr foldCons foldNil
11631162
11641163-- | Like 'distribute' but for folds that return (), this can be more efficient
11651164-- than 'distribute' as it does not need to maintain state.
@@ -1173,9 +1172,8 @@ distribute_ fs = Fold step initial extract
11731172 step ss a = do
11741173 Prelude.mapM_ (\(Fold s i _) -> i >>= \r -> void (s r a)) ss
11751174 return ss
1176− extract ss = do
1175+ extract ss =
11771176 Prelude.mapM_ (\(Fold _ i e) -> i >>= \r -> e r) ss
1178− return ()
11791177
11801178------------------------------------------------------------------------------
11811179-- Partitioning
@@ -1235,7 +1233,7 @@ partitionByM f (Fold stepL beginL doneL) (Fold stepR beginR doneR) =
12351233 r <- f a
12361234 case r of
12371235 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
12391237 done (Tuple' xL xR) = (,) <$> doneL xL <*> doneR xR
12401238
12411239-- 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) =
13691367 initFold (Fold s i e) = i >>= \r -> return (Fold s (return r) e)
13701368 initial = do
13711369 mp <- Prelude.mapM initFold kv
1372− dacc <- dinitial
1373− return (Tuple' mp dacc)
1370+ Tuple' mp <$> dinitial
1371+
13741372 step (Tuple' mp dacc) a
13751373 | (k, a') <- f a
13761374 = 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)
252252connect :: (Word8, Word8, Word8, Word8) -> PortNumber -> IO Socket
253253connect addr port = do
254254 sock <- socket AF_INET Stream defaultProtocol
255− (Net.connect sock $ SockAddrInet port (Net.tupleToHostAddress addr))
255+ Net.connect sock (SockAddrInet port (Net.tupleToHostAddress addr))
256256 `onException` Net.close sock
257257 return sock
258258
src/Streamly/Internal/Prelude.hs+1−1
@@ -3207,7 +3207,7 @@ parseIterate
32073207 -> t m a
32083208 -> t m b
32093209parseIterate 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)
32113211
32123212------------------------------------------------------------------------------
32133213-- Grouping/Splitting