@@ -103,6 +103,7 @@ module Streamly.Internal.Data.Parser
103 -- Grab a sequence of input elements by inspecting them
103 -- Grab a sequence of input elements by inspecting them
104 -- ** Exact match
104 -- ** Exact match
108 -- ** By predicate
109 -- ** By predicate
@@ -1024,8 +1025,6 @@ groupByRollingEither :: Monad m =>
1024 (a -> a -> Bool) -> Fold m a b -> Fold m a c -> Parser m a (Either b c)
1025 (a -> a -> Bool) -> Fold m a b -> Fold m a c -> Parser m a (Either b c)
1025groupByRollingEither eq f1 = D.toParserK . D.groupByRollingEither eq f1
1026groupByRollingEither eq f1 = D.toParserK . D.groupByRollingEither eq f1
1027−-- XXX Use a stream instead of a list so that we can use any container type.
1029-- | Match the given sequence of elements using the given comparison function.
1028-- | Match the given sequence of elements using the given comparison function.
1031-- >>> Stream.parse (Parser.eqBy (==) "string") $ Stream.fromList "string"
1030-- >>> Stream.parse (Parser.eqBy (==) "string") $ Stream.fromList "string"
@@ -1039,6 +1038,11 @@ groupByRollingEither eq f1 = D.toParserK . D.groupByRollingEither eq f1
1039eqBy :: Monad m => (a -> a -> Bool) -> [a] -> Parser m a ()
1038eqBy :: Monad m => (a -> a -> Bool) -> [a] -> Parser m a ()
1040eqBy cmp = D.toParserK . D.eqBy cmp
1039eqBy cmp = D.toParserK . D.eqBy cmp
1041+-- | Like eqBy but uses a stream instead of a list
1042+{-# INLINE matchBy #-}
1043+matchBy :: Monad m => (a -> a -> Bool) -> Stream m a -> Parser m a ()
1044+matchBy cmp = D.toParserK . D.matchBy cmp . Stream.toStreamD
1042-- | Match the input sequence with the supplied list and return it if
1046-- | Match the input sequence with the supplied list and return it if
1043-- successful.
1047-- successful.