Skip to content

Commit 2dd8908

Browse files
Mention correct function name in parser error
1 parent 3d8fab1 commit 2dd8908

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

core/src/Streamly/Internal/Data/Parser.hs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2153,11 +2153,11 @@ groupByRollingEither
21532153
-- Right "string"
21542154
--
21552155
-- >>> Stream.parsePos (Parser.listEqBy (==) "mismatch") $ Stream.fromList "match"
2156-
-- Left (ParseErrorPos 2 "streamEqBy: mismtach occurred")
2156+
-- Left (ParseErrorPos 2 "listEqBy: mismatch occurred")
21572157
--
21582158
{-# INLINE listEqBy #-}
21592159
listEqBy :: Monad m => (a -> a -> Bool) -> [a] -> Parser a m [a]
2160-
listEqBy cmp xs = streamEqByInternal cmp (D.fromList xs) *> fromPure xs
2160+
listEqBy cmp xs = streamEqByInternal "listEqBy" cmp (D.fromList xs) *> fromPure xs
21612161
{-
21622162
listEqBy cmp str = Parser step initial extract
21632163
@@ -2188,8 +2188,8 @@ listEqBy cmp str = Parser step initial extract
21882188
-}
21892189

21902190
{-# INLINE streamEqByInternal #-}
2191-
streamEqByInternal :: Monad m => (a -> a -> Bool) -> D.Stream m a -> Parser a m ()
2192-
streamEqByInternal cmp (D.Stream sstep state) = Parser step initial extract
2191+
streamEqByInternal :: Monad m => String -> (a -> a -> Bool) -> D.Stream m a -> Parser a m ()
2192+
streamEqByInternal fname cmp (D.Stream sstep state) = Parser step initial extract
21932193

21942194
where
21952195

@@ -2210,19 +2210,19 @@ streamEqByInternal cmp (D.Stream sstep state) = Parser step initial extract
22102210
D.Yield x1 s -> SContinue 1 (Just' x1, s)
22112211
D.Stop -> SDone 1 ()
22122212
D.Skip s -> SContinue 0 (Nothing', s)
2213-
else return $ SError "streamEqBy: mismtach occurred"
2213+
else return $ SError (fname ++ ": mismatch occurred")
22142214
step (Nothing', st) a = do
22152215
r <- sstep defState st
22162216
return
22172217
$ case r of
22182218
D.Yield x s -> do
22192219
if x `cmp` a
22202220
then SContinue 1 (Nothing', s)
2221-
else SError "streamEqBy: mismatch occurred"
2221+
else SError (fname ++ ": mismatch occurred")
22222222
D.Stop -> SDone 0 ()
22232223
D.Skip s -> SContinue 0 (Nothing', s)
22242224

2225-
extract _ = return $ FError "streamEqBy: end of input"
2225+
extract _ = return $ FError (fname ++ ": end of input")
22262226

22272227
-- | Like 'listEqBy' but uses a stream instead of a list and does not return
22282228
-- the stream.
@@ -2231,7 +2231,7 @@ streamEqByInternal cmp (D.Stream sstep state) = Parser step initial extract
22312231
streamEqBy :: Monad m => (a -> a -> Bool) -> D.Stream m a -> Parser a m ()
22322232
-- XXX Somehow composing this with "*>" is much faster on the microbenchmark.
22332233
-- Need to investigate why.
2234-
streamEqBy cmp stream = streamEqByInternal cmp stream *> fromPure ()
2234+
streamEqBy cmp stream = streamEqByInternal "streamEqBy" cmp stream *> fromPure ()
22352235

22362236
-- Rename to "list".
22372237
-- | Match the input sequence with the supplied list and return it if

0 commit comments

Comments
 (0)