@@ -1579,7 +1579,7 @@ isPrefixOf m1 m2 = D.isPrefixOf (toStreamD m1) (toStreamD m2)
15791579--
15801580{-# INLINE isSuffixOf #-}
15811581isSuffixOf :: (Monad m, Eq a) => SerialT m a -> SerialT m a -> m Bool
1582−isSuffixOf suffix stream = isPrefixOf (reverse suffix) (reverse stream)
1582+isSuffixOf suffix stream = reverse suffix `isPrefixOf` reverse stream
15831583
15841584-- | Returns 'True' if the first stream is an infix of the second. A stream is
15851585-- considered an infix of itself.
@@ -1753,7 +1753,7 @@ toListRev = D.toListRev . toStreamD
17531753{-# DEPRECATED toHandle
17541754 "Please use Streamly.FileSystem.Handle module (see the changelog)" #-}
17551755toHandle :: MonadIO m => IO.Handle -> SerialT m String -> m ()
1756−toHandle h m = go m
1756+toHandle h = go
17571757 where
17581758 go m1 =
17591759 let stop = return ()
@@ -3023,7 +3023,7 @@ concatMapIterateWith
30233023 -> (a -> t m a)
30243024 -> t m a
30253025 -> t m a
3026−concatMapIterateWith combine f xs = concatMapWith combine go xs
3026+concatMapIterateWith combine f = concatMapWith combine go
30273027 where
30283028 go x = yield x `combine` concatMapWith combine go (f x)
30293029
@@ -3058,7 +3058,7 @@ concatMapTreeWith
30583058 -> (a -> t m (Either a b))
30593059 -> t m (Either a b) -- Should be t m a?
30603060 -> t m (Either a b)
3061−concatMapTreeWith combine f xs = concatMapWith combine go xs
3061+concatMapTreeWith combine f = concatMapWith combine go
30623062 where
30633063 go (Left tree) = yield (Left tree) `combine` concatMapWith combine go (f tree)
30643064 go (Right leaf) = yield $ Right leaf
@@ -3959,7 +3959,7 @@ pollCounts ::
39593959pollCounts predicate transf f xs =
39603960 D.fromStreamD
39613961 $ D.pollCounts predicate (D.toStreamD . transf . D.fromStreamD) f
3962− $ (D.toStreamD xs)
3962+ $ D.toStreamD xs
39633963
39643964-- | Calls the supplied function with the number of elements consumed
39653965-- every @n@ seconds. The given function is run in a separate thread
@@ -3985,7 +3985,7 @@ tapRate ::
39853985 -> (Int -> m b)
39863986 -> t m a
39873987 -> t m a
3988−tapRate n f xs = D.fromStreamD $ D.tapRate n f $ (D.toStreamD xs)
3988+tapRate n f xs = D.fromStreamD $ D.tapRate n f $ D.toStreamD xs
39893989
39903990-- | Apply a monadic function to each element flowing through the stream and
39913991-- discard the results.
@@ -4186,7 +4186,7 @@ classifySessionsBy
41864186 -> t m (k, b) -- ^ session key, fold result
41874187classifySessionsBy tick timeout reset ejectPred
41884188 (Fold step initial extract) str =
4189− concatMap (\session -> sessionOutputStream session)
4189+ concatMap sessionOutputStream
41904190 $ scanlM' sstep szero stream
41914191
41924192 where
@@ -4213,7 +4213,7 @@ classifySessionsBy tick timeout reset ejectPred
42134213 -- We use the first strategy as of now.
42144214
42154215 -- Got a new stream input element
4216− sstep (session@SessionState{..}) (Just (key, value, timestamp)) = do
4216+ sstep session@SessionState{..} (Just (key, value, timestamp)) = do
42174217 -- XXX we should use a heap in pinned memory to scale it to a large
42184218 -- size
42194219 --
@@ -4273,7 +4273,7 @@ classifySessionsBy tick timeout reset ejectPred
42734273 -- Insert the new session in heap
42744274 let expiry = addToAbsTime timestamp timeoutMs
42754275 hp' = H.insert (Entry expiry key) hp
4276− in return $ (hp', mp, out, (cnt + 1))
4276+ in return (hp', mp, out, cnt + 1)
42774277 -- updating old entry
42784278 Just _ -> return vars
42794279
@@ -4288,7 +4288,7 @@ classifySessionsBy tick timeout reset ejectPred
42884288 }
42894289
42904290 -- Got a timer tick event
4291− sstep (sessionState@SessionState{..}) Nothing =
4291+ sstep sessionState@SessionState{..} Nothing =
42924292 let curTime = addToAbsTime sessionCurTime tickMs
42934293 in ejectExpired sessionState curTime
42944294
@@ -4302,12 +4302,12 @@ classifySessionsBy tick timeout reset ejectPred
43024302 sess <- extract acc
43034303 let out1 = (key, fromEither sess) `K.cons` out
43044304 let mp1 = Map.delete key mp
4305− return (hp, mp1, out1, (cnt - 1))
4305+ return (hp, mp1, out1, cnt - 1)
43064306
43074307 ejectOne (hp, mp, out, !cnt) = do
43084308 let hres = H.uncons hp
43094309 case hres of
4310− Just (Entry expiry key, hp1) -> do
4310+ Just (Entry expiry key, hp1) ->
43114311 case Map.lookup key mp of
43124312 Nothing -> ejectOne (hp1, mp, out, cnt)
43134313 Just (Tuple' latestTS acc) -> do
@@ -4322,7 +4322,7 @@ classifySessionsBy tick timeout reset ejectPred
43224322 assert (Map.null mp) (return ())
43234323 return (hp, mp, out, cnt)
43244324
4325− ejectExpired (session@SessionState{..}) curTime = do
4325+ ejectExpired session@SessionState{..} curTime = do
43264326 (hp', mp', out, count) <-
43274327 ejectLoop sessionTimerHeap sessionKeyValueMap K.nil sessionCount
43284328 return $ session
@@ -4339,14 +4339,14 @@ classifySessionsBy tick timeout reset ejectPred
43394339 let hres = H.uncons hp
43404340 case hres of
43414341 Just (Entry expiry key, hp1) -> do
4342− (eject, force) <- do
4342+ (eject, force) <-
43434343 if curTime >= expiry
43444344 then return (True, False)
43454345 else do
43464346 r <- ejectPred cnt
43474347 return (r, r)
43484348 if eject
4349− then do
4349+ then
43504350 case Map.lookup key mp of
43514351 Nothing -> ejectLoop hp1 mp out cnt
43524352 Just (Tuple' latestTS acc) -> do
@@ -4392,8 +4392,8 @@ classifyKeepAliveSessions
43924392 -> Fold m a (Either b b) -- ^ Fold to be applied to session payload data
43934393 -> t m (k, a, AbsTime) -- ^ session key, data, timestamp
43944394 -> t m (k, b)
4395−classifyKeepAliveSessions timeout ejectPred =
4396− classifySessionsBy 1 timeout True ejectPred
4395+classifyKeepAliveSessions timeout =
4396+ classifySessionsBy 1 timeout True
43974397
43984398------------------------------------------------------------------------------
43994399-- Keyed tumbling windows
@@ -4450,8 +4450,8 @@ classifySessionsOf
44504450 -> Fold m a (Either b b) -- ^ Fold to be applied to session events
44514451 -> t m (k, a, AbsTime) -- ^ session key, data, timestamp
44524452 -> t m (k, b)
4453−classifySessionsOf interval ejectPred =
4454− classifySessionsBy 1 interval False ejectPred
4453+classifySessionsOf interval =
4454+ classifySessionsBy 1 interval False
44554455
44564456------------------------------------------------------------------------------
44574457-- Exceptions
@@ -4526,7 +4526,7 @@ finallyIO action xs = D.fromStreamD $ D.finallyIO action $ D.toStreamD xs
45264526bracket :: (IsStream t, MonadCatch m)
45274527 => m b -> (b -> m c) -> (b -> t m a) -> t m a
45284528bracket bef aft bet = D.fromStreamD $
4529− D.bracket bef aft (\x -> toStreamD $ bet x)
4529+ D.bracket bef aft (toStreamD . bet)
45304530
45314531-- | Run the first action before the stream starts and remember its output,
45324532-- generate a stream using the output, run the second action using the
@@ -4539,7 +4539,7 @@ bracket bef aft bet = D.fromStreamD $
45394539bracketIO :: (IsStream t, MonadAsync m, MonadCatch m)
45404540 => m b -> (b -> m c) -> (b -> t m a) -> t m a
45414541bracketIO bef aft bet = D.fromStreamD $
4542− D.bracketIO bef aft (\x -> toStreamD $ bet x)
4542+ D.bracketIO bef aft (toStreamD . bet)
45434543
45444544-- | When evaluating a stream if an exception occurs, stream evaluation aborts
45454545-- and the specified exception handler is run with the exception as argument.
@@ -4549,7 +4549,7 @@ bracketIO bef aft bet = D.fromStreamD $
45494549handle :: (IsStream t, MonadCatch m, Exception e)
45504550 => (e -> t m a) -> t m a -> t m a
45514551handle handler xs =
4552− D.fromStreamD $ D.handle (\e -> D.toStreamD $ handler e) $ D.toStreamD xs
4552+ D.fromStreamD $ D.handle (D.toStreamD . handler) $ D.toStreamD xs
45534553
45544554------------------------------------------------------------------------------
45554555-- Generalize the underlying monad