@@ -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