on master help sign in
Minor non-functional simplification in sliceSepBy and sliceEndWith
969f8c0Adithya Kumar
src/Streamly/Internal/Data/Fold.hs+2−6
@@ -1036,12 +1036,10 @@ splitAt n fld = splitWith (,) (takeLE n fld)
1036{-# INLINE sliceSepBy #-}
1036{-# INLINE sliceSepBy #-}
1037sliceSepBy :: Monad m => (a -> Bool) -> Fold m a b -> Fold m a b
1037sliceSepBy :: Monad m => (a -> Bool) -> Fold m a b -> Fold m a b
1038sliceSepBy predicate (Fold fstep finitial fextract) =
1038sliceSepBy predicate (Fold fstep finitial fextract) =
1039− Fold step initial fextract
1039+ Fold step finitial fextract
1040
1040
1041 where
1041 where
1042
1042
1043− initial = finitial
1044−
1045 step s a =
1043 step s a =
1046 if not (predicate a)
1044 if not (predicate a)
1047 then fstep s a
1045 then fstep s a
@@ -1060,12 +1058,10 @@ sliceSepBy predicate (Fold fstep finitial fextract) =
1060{-# INLINE sliceEndWith #-}
1058{-# INLINE sliceEndWith #-}
1061sliceEndWith :: Monad m => (a -> Bool) -> Fold m a b -> Fold m a b
1059sliceEndWith :: Monad m => (a -> Bool) -> Fold m a b -> Fold m a b
1062sliceEndWith predicate (Fold fstep finitial fextract) =
1060sliceEndWith predicate (Fold fstep finitial fextract) =
1063− Fold step initial fextract
1061+ Fold step finitial fextract
1064
1062
1065 where
1063 where
1066
1064
1067− initial = finitial
1068−
1069 step s a = do
1065 step s a = do
1070 res <- fstep s a
1066 res <- fstep s a
1071 if not (predicate a)
1067 if not (predicate a)