on master help sign in
Revert "Introduce and expose chunkEq and chunkEqBy"

This reverts commit 196b7a7105fcf50103c289433ba97cfc4b8a87af.

commitdef5297742913a6cd3300d4bf66cda9f9968c5e6 authorAdithya Kumar <adithya@composewell.com> dateWed 19 Jul 2023, 11:10 (3 years ago) parentdaabcb8
3 files changed−45
benchmark/Streamly/Benchmark/Data/Parser.hs−10 core/src/Streamly/Data/Parser.hs−2 core/src/Streamly/Internal/Data/Parser/ParserD.hs−33
benchmark/Streamly/Benchmark/Data/Parser.hs−10
@@ -158,14 +158,6 @@ takeFramedByEsc_ _ = Stream.parse parser
158158listEqBy :: Int -> Stream IO Int -> IO (Either ParseError [Int])
159159listEqBy len = Stream.parse (PR.listEqBy (==) [1 .. len])
160160
161−{-# INLINE chunkEqBy #-}
162−chunkEqBy :: Int -> Stream IO Int -> IO (Either ParseError [Int])
163−chunkEqBy len = Stream.parse (PR.chunkEqBy (==) [1 .. len])
164−
165−{-# INLINE chunkEq #-}
166−chunkEq :: Int -> Stream IO Int -> IO (Either ParseError [Int])
167−chunkEq len = Stream.parse (PR.chunkEq [1 .. len])
168−
169161{-# INLINE streamEqBy #-}
170162streamEqBy :: Int -> Stream IO Int -> IO (Either ParseError ())
171163streamEqBy len = Stream.parse (PR.streamEqBy (==) (Stream.enumerateFromTo 1 len))
@@ -839,8 +831,6 @@ o_n_heap_serial value =
839831 , benchIOSink value "manyAlt" manyAlt
840832 , benchIOSink value "someAlt" someAlt
841833 , benchIOSink value "listEqBy" (listEqBy value)
842− , benchIOSink value "chunkEqBy" (chunkEqBy value)
843− , benchIOSink value "chunkEq" (chunkEq value)
844834 ]
845835
846836-- accumulate results in a list in IO
core/src/Streamly/Data/Parser.hs−2
@@ -60,8 +60,6 @@ module Streamly.Data.Parser
6060 , streamEqBy
6161 , listEqBy
6262 , listEq
63− , chunkEqBy
64− , chunkEq
6563
6664 -- * Combinators
6765 -- Mapping on output
core/src/Streamly/Internal/Data/Parser/ParserD.hs−33
@@ -78,8 +78,6 @@ module Streamly.Internal.Data.Parser.ParserD
7878 -- ** Exact match
7979 , listEq
8080 , listEqBy
81− , chunkEq
82− , chunkEqBy
8381 , streamEqBy
8482 , subsequenceBy
8583
@@ -2205,37 +2203,6 @@ streamEqBy cmp stream = streamEqByInternal cmp stream *> fromPure ()
22052203listEq :: (Monad m, Eq a) => [a] -> Parser a m [a]
22062204listEq = listEqBy (==)
22072205
2208−-- | Match the given sequence of elements using the given comparison function.
2209−-- Returns the original sequence if successful.
2210−--
2211−-- Definition:
2212−--
2213−-- >>> chunkEqBy cmp xs = Parser.streamEqBy cmp (Stream.fromFoldable xs) *> Parser.fromPure xs
2214−--
2215−-- Examples:
2216−--
2217−-- >>> Stream.parse (Parser.chunkEqBy (==) "string") $ Stream.fromList "string"
2218−-- Right "string"
2219−--
2220−-- >>> Stream.parse (Parser.chunkEqBy (==) "mismatch") $ Stream.fromList "match"
2221−-- Left (ParseError "streamEqBy: mismtach occurred")
2222−--
2223−{-# INLINE chunkEqBy #-}
2224−chunkEqBy
2225− :: (Foldable f, Monad m) => (a -> a -> Bool) -> f a -> Parser a m (f a)
2226−chunkEqBy cmp xs = streamEqByInternal cmp (D.fromFoldable xs) *> fromPure xs
2227−
2228−-- | Match the input sequence with the supplied Foldable and return it if
2229−-- successful.
2230−--
2231−-- >>> chunkEq = Parser.chunkEqBy (==)
2232−--
2233−{-# INLINE chunkEq #-}
2234−chunkEq
2235− :: (Eq a, Foldable f, Monad m)
2236− => f a -> Parser a m (f a)
2237−chunkEq = chunkEqBy (==)
2238−
22392206-- | Match if the input stream is a subsequence of the argument stream i.e. all
22402207-- the elements of the input stream occur, in order, in the argument stream.
22412208-- The elements do not have to occur consecutively. A sequence is considered a