@@ -15,9 +15,7 @@ module Streamly.Internal.Data.Stream.Eliminate
1515 (
1616 -- * Running a Parser
1717 parse
18- , parseD
1918 , parseBreak
20- , parseBreakD
2119
2220 -- * Deconstruction
2321 , uncons
@@ -58,10 +56,15 @@ module Streamly.Internal.Data.Stream.Eliminate
5856 , stripPrefix
5957 , stripSuffix
6058 , stripSuffixUnbox
59+
60+ -- * Deprecated
61+ , parseD
62+ , parseBreakD
6163 )
6264where
6365
6466#include "inline.hs"
67+ #include "deprecation.h"
6568
6669import Control.Exception (assert )
6770import Control.Monad.IO.Class (MonadIO (.. ))
@@ -115,16 +118,8 @@ foldr1 f m = do
115118{-# ANN type List NoSpecConstr #-}
116119newtype List a = List { getList :: [a ]}
117120
118- -- | Run a 'Parse' over a stream.
119- {-# INLINE_NORMAL parseD #-}
120- parseD
121- :: Monad m
122- => PRD. Parser a m b
123- -> Stream m a
124- -> m (Either ParseError b )
125- parseD parser strm = do
126- (b, _) <- parseBreakD parser strm
127- return b
121+ -- XXX There is INLINE_NORMAL on parseD but INLINE [3] on parse
122+ -- XXX There is INLINE on parseBreakD but INLINE_NORMAL on parseBreak
128123
129124-- | Parse a stream using the supplied 'Parser'.
130125--
@@ -139,8 +134,11 @@ parseD parser strm = do
139134-- Note: @parse p@ is not the same as @head . parseMany p@ on an empty stream.
140135--
141136{-# INLINE [3] parse #-}
142- parse :: Monad m => PR. Parser a m b -> Stream m a -> m (Either ParseError b )
143- parse = parseD
137+ parseD , parse :: Monad m => PR. Parser a m b -> Stream m a -> m (Either ParseError b )
138+ parse parser strm = do
139+ (b, _) <- parseBreak parser strm
140+ return b
141+ RENAME (parseD,parse)
144142
145143-- XXX It may be a good idea to use constant sized chunks for backtracking. We
146144-- can take a byte stream but when we have to backtrack we create constant
@@ -150,13 +148,13 @@ parse = parseD
150148-- reducing bookkeeping work.
151149
152150-- | Run a 'Parse' over a stream and return rest of the Stream.
153- {-# INLINE_NORMAL parseBreakD #-}
154- parseBreakD
151+ {-# INLINE_NORMAL parseBreak #-}
152+ parseBreakD, parseBreak
155153 :: Monad m
156154 => PRD. Parser a m b
157155 -> Stream m a
158156 -> m (Either ParseError b , Stream m a )
159- parseBreakD (PRD. Parser pstep initial extract) stream@ (Stream step state) = do
157+ parseBreak (PRD. Parser pstep initial extract) stream@ (Stream step state) = do
160158 res <- initial
161159 case res of
162160 PRD. IPartial s -> go SPEC state (List [] ) s
@@ -336,11 +334,7 @@ parseBreakD (PRD.Parser pstep initial extract) stream@(Stream step state) = do
336334 let src = Prelude. reverse $ getList buf
337335 return (Left (ParseError err), fromList src)
338336
339- -- | Parse a stream using the supplied 'Parser'.
340- --
341- {-# INLINE parseBreak #-}
342- parseBreak :: Monad m => PR. Parser a m b -> Stream m a -> m (Either ParseError b , Stream m a )
343- parseBreak = parseBreakD
337+ RENAME (parseBreakD,parseBreak)
344338
345339------------------------------------------------------------------------------
346340-- Specialized Folds
0 commit comments