@@ -2159,7 +2159,7 @@ groupByRollingEither
2160{-# INLINE listEqBy #-}
2160{-# INLINE listEqBy #-}
2161listEqBy :: Monad m => (a -> a -> Bool) -> [a] -> Parser a m [a]
2161listEqBy :: Monad m => (a -> a -> Bool) -> [a] -> Parser a m [a]
2162−listEqBy cmp xs = streamEqBy cmp (D.fromList xs) *> fromPure xs
2162+listEqBy cmp xs = streamEqByInternal cmp (D.fromList xs) *> fromPure xs
2164listEqBy cmp str = Parser step initial extract
2164listEqBy cmp str = Parser step initial extract
@@ -2189,14 +2189,9 @@ listEqBy cmp str = Parser step initial extract
2189 ++ show (length xs) ++ " elements"
2189 ++ show (length xs) ++ " elements"
2192−-- | Like 'listEqBy' but uses a stream instead of a list and does not return
2192+{-# INLINE streamEqByInternal #-}
2195−-- See also: "Streamly.Data.Stream.streamEqBy"
2197−{-# INLINE streamEqBy #-}
2198−streamEqBy :: Monad m => (a -> a -> Bool) -> D.Stream m a -> Parser a m ()
2193+streamEqByInternal :: Monad m => (a -> a -> Bool) -> D.Stream m a -> Parser a m ()
2199−streamEqBy cmp (D.Stream sstep state) = Parser step initial extract
2194+streamEqByInternal cmp (D.Stream sstep state) = Parser step initial extract
@@ -2231,6 +2226,15 @@ streamEqBy cmp (D.Stream sstep state) = Parser step initial extract
2232 extract _ = return $ Error "streamEqBy: end of input"
2227 extract _ = return $ Error "streamEqBy: end of input"
2229+-- | Like 'listEqBy' but uses a stream instead of a list and does not return
2232+{-# INLINE streamEqBy #-}
2233+streamEqBy :: Monad m => (a -> a -> Bool) -> D.Stream m a -> Parser a m ()
2234+-- XXX Somehow composing this with "*>" is much faster on the microbenchmark.
2235+-- Need to investigate why.
2236+streamEqBy cmp stream = streamEqByInternal cmp stream *> fromPure ()
2234-- Rename to "list".
2238-- Rename to "list".
2235-- | Match the input sequence with the supplied list and return it if
2239-- | Match the input sequence with the supplied list and return it if
2236-- successful.
2240-- successful.