@@ -103,6 +103,7 @@ module Streamly.Internal.Data.Parser
103103 -- Grab a sequence of input elements by inspecting them
104104 -- ** Exact match
105105 , eqBy
106+ , matchBy
106107 , list
107108
108109 -- ** By predicate
@@ -1024,8 +1025,6 @@ groupByRollingEither :: Monad m =>
10241025 (a -> a -> Bool) -> Fold m a b -> Fold m a c -> Parser m a (Either b c)
10251026groupByRollingEither eq f1 = D.toParserK . D.groupByRollingEither eq f1
10261027
1027−-- XXX Use a stream instead of a list so that we can use any container type.
1028−
10291028-- | Match the given sequence of elements using the given comparison function.
10301029--
10311030-- >>> Stream.parse (Parser.eqBy (==) "string") $ Stream.fromList "string"
@@ -1039,6 +1038,11 @@ groupByRollingEither eq f1 = D.toParserK . D.groupByRollingEither eq f1
10391038eqBy :: Monad m => (a -> a -> Bool) -> [a] -> Parser m a ()
10401039eqBy cmp = D.toParserK . D.eqBy cmp
10411040
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
1045+
10421046-- | Match the input sequence with the supplied list and return it if
10431047-- successful.
10441048--