Skip to content

Commit a1e6c4b

Browse files
committed
Fix some hlint warnings
1 parent 00b7dba commit a1e6c4b

2 files changed

Lines changed: 24 additions & 27 deletions

File tree

src/Streaming/Internal.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -971,9 +971,9 @@ zipsWith' phi = loop
971971
loop :: Stream f m r -> Stream g m r -> Stream h m r
972972
loop s t = case s of
973973
Return r -> Return r
974-
Step fs -> case t of
974+
Step fs -> case t of
975975
Return r -> Return r
976-
Step gs -> Step $ phi loop fs gs
976+
Step gs -> Step $ phi loop fs gs
977977
Effect n -> Effect $ fmap (loop s) n
978978
Effect m -> Effect $ fmap (flip loop t) m
979979
{-# INLINABLE zipsWith' #-}
@@ -1038,7 +1038,7 @@ separate odd_even
10381038
10391039
Now, for example, it is convenient to fold on the left and right values separately:
10401040
1041-
>>> S.toList $ S.toList $ separate odd_even
1041+
>>> S.toList $ S.toList $ separate odd_even
10421042
[2,4,6,8,10] :> ([1,3,5,7,9] :> ())
10431043
10441044

src/Streaming/Prelude.hs

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -374,17 +374,17 @@ False :> "hi"
374374
-}
375375

376376
mapOf :: (a -> b) -> Of a r -> Of b r
377-
mapOf f (a:> b) = (f a :> b)
377+
mapOf f (a :> b) = f a :> b
378378
{-# INLINE mapOf #-}
379379

380380
{-| A lens into the first element of a left-strict pair -}
381381
_first :: Functor f => (a -> f a') -> Of a b -> f (Of a' b)
382-
_first afb (a:>b) = fmap (\c -> (c:>b)) (afb a)
382+
_first afb (a :> b) = fmap (\c -> c :> b) (afb a)
383383
{-# INLINE _first #-}
384384

385385
{-| A lens into the second element of a left-strict pair -}
386386
_second :: Functor f => (b -> f b') -> Of a b -> f (Of a b')
387-
_second afb (a:>b) = fmap (\c -> (a:>c)) (afb b)
387+
_second afb (a :> b) = fmap (\c -> a :> c) (afb b)
388388
{-# INLINABLE _second #-}
389389

390390
all :: Monad m => (a -> Bool) -> Stream (Of a) m r -> m (Of Bool r)
@@ -449,8 +449,8 @@ break :: Monad m => (a -> Bool) -> Stream (Of a) m r
449449
break thePred = loop where
450450
loop str = case str of
451451
Return r -> Return (Return r)
452-
Effect m -> Effect $ fmap loop m
453-
Step (a :> rest) -> if (thePred a)
452+
Effect m -> Effect $ fmap loop m
453+
Step (a :> rest) -> if thePred a
454454
then Return (Step (a :> rest))
455455
else Step (a :> loop rest)
456456
{-# INLINABLE break #-}
@@ -481,7 +481,7 @@ breakWhen step begin done thePred = loop0 begin
481481
Return r -> return (return r)
482482
Effect mn -> Effect $ fmap (loop0 x) mn
483483
Step (a :> rest) -> loop a (step x a) rest
484-
loop a !x stream = do
484+
loop a !x stream =
485485
if thePred (done x)
486486
then return (yield a >> stream)
487487
else case stream of
@@ -676,9 +676,6 @@ e<Enter>
676676
677677
>>> S.toList $ concats $ maps (S.drop 4) $ chunksOf 5 $ each [1..20]
678678
[5,10,15,20] :> ()
679-
680-
681-
682679
-}
683680

684681
drop :: (Monad m) => Int -> Stream (Of a) m r -> Stream (Of a) m r
@@ -1292,7 +1289,7 @@ ateb
12921289
-}
12931290

12941291
map :: Monad m => (a -> b) -> Stream (Of a) m r -> Stream (Of b) m r
1295-
map f = maps (\(x :> rest) -> f x :> rest)
1292+
map f = maps (\(x :> rest) -> f x :> rest)
12961293
-- loop where --
12971294
-- loop stream = case stream of
12981295
-- Return r -> Return r
@@ -1732,7 +1729,7 @@ reread step s = loop where
17321729
scan :: Monad m => (x -> a -> x) -> x -> (x -> b) -> Stream (Of a) m r -> Stream (Of b) m r
17331730
scan step begin done str = Step (done begin :> loop begin str)
17341731
where
1735-
loop !acc stream = do
1732+
loop !acc stream =
17361733
case stream of
17371734
Return r -> Return r
17381735
Effect m -> Effect (fmap (loop acc) m)
@@ -1793,11 +1790,11 @@ data Maybe' a = Just' a | Nothing'
17931790
scanned :: Monad m => (x -> a -> x) -> x -> (x -> b) -> Stream (Of a) m r -> Stream (Of (a,b)) m r
17941791
scanned step begin done = loop Nothing' begin
17951792
where
1796-
loop !m !x stream = do
1793+
loop !m !x stream =
17971794
case stream of
17981795
Return r -> return r
17991796
Effect mn -> Effect $ fmap (loop m x) mn
1800-
Step (a :> rest) -> do
1797+
Step (a :> rest) ->
18011798
case m of
18021799
Nothing' -> do
18031800
let !acc = step x a
@@ -2197,18 +2194,18 @@ yield a = Step (a :> Return ())
21972194

21982195
-- | Zip two 'Stream's
21992196
zip :: Monad m
2200-
=> (Stream (Of a) m r)
2201-
-> (Stream (Of b) m r)
2202-
-> (Stream (Of (a,b)) m r)
2197+
=> Stream (Of a) m r
2198+
-> Stream (Of b) m r
2199+
-> Stream (Of (a,b)) m r
22032200
zip = zipWith (,)
22042201
{-# INLINE zip #-}
22052202

22062203
-- | Zip two 'Stream's using the provided combining function
22072204
zipWith :: Monad m
22082205
=> (a -> b -> c)
2209-
-> (Stream (Of a) m r)
2210-
-> (Stream (Of b) m r)
2211-
-> (Stream (Of c) m r)
2206+
-> Stream (Of a) m r
2207+
-> Stream (Of b) m r
2208+
-> Stream (Of c) m r
22122209
zipWith f = loop
22132210
where
22142211
loop str0 str1 = case str0 of
@@ -2249,10 +2246,10 @@ zipWith3 op = loop where
22492246

22502247
-- | Zip three 'Stream's together
22512248
zip3 :: Monad m
2252-
=> (Stream (Of a) m r)
2253-
-> (Stream (Of b) m r)
2254-
-> (Stream (Of c) m r)
2255-
-> (Stream (Of (a,b,c)) m r)
2249+
=> Stream (Of a) m r
2250+
-> Stream (Of b) m r
2251+
-> Stream (Of c) m r
2252+
-> Stream (Of (a,b,c)) m r
22562253
zip3 = zipWith3 (,,)
22572254
{-# INLINABLE zip3 #-}
22582255

@@ -2924,7 +2921,7 @@ mapMaybeM phi = loop where
29242921
loop stream = case stream of
29252922
Return r -> Return r
29262923
Effect m -> Effect (fmap loop m)
2927-
Step (a :> snext) -> Effect $ do
2924+
Step (a :> snext) -> Effect $
29282925
flip fmap (phi a) $ \x -> case x of
29292926
Nothing -> loop snext
29302927
Just b -> Step (b :> loop snext)

0 commit comments

Comments
 (0)