@@ -26,7 +26,7 @@ module Streamly.Internal.Data.Parser.Chunked.Type
28 , ParseResult (..)
28 , ParseResult (..)
29− , ParserChunked (..)
29+ , ChunkParser (..)
30 , fromPure
30 , fromPure
31 , fromEffect
31 , fromEffect
@@ -98,7 +98,7 @@ instance Functor ParseResult where
98-- input without a result or return a result with no further input to be
98-- input without a result or return a result with no further input to be
99-- consumed.
99-- consumed.
101−newtype ParserChunked a m b = MkParser
101+newtype ChunkParser a m b = MkParser
102 { runParser :: forall r.
102 { runParser :: forall r.
103 -- XXX Maintain and pass the original position in the stream. that
103 -- XXX Maintain and pass the original position in the stream. that
104 -- way we can also report better errors. Use a Context structure for
104 -- way we can also report better errors. Use a Context structure for
@@ -130,7 +130,7 @@ newtype ParserChunked a m b = MkParser
130-- XXX rewrite this using ParserD, expose rmapM from ParserD.
130-- XXX rewrite this using ParserD, expose rmapM from ParserD.
131-- | Maps a function over the output of the parser.
131-- | Maps a function over the output of the parser.
133−instance Functor m => Functor (ParserChunked a m) where
133+instance Functor m => Functor (ChunkParser a m) where
134 {-# INLINE fmap #-}
134 {-# INLINE fmap #-}
135 fmap f parser = MkParser $ \n st arr pk ->
135 fmap f parser = MkParser $ \n st arr pk ->
136 let pk1 res = pk (fmap f res)
136 let pk1 res = pk (fmap f res)
@@ -147,7 +147,7 @@ instance Functor m => Functor (ParserChunked a m) where
147-- /Pre-release/
147-- /Pre-release/
149{-# INLINE fromPure #-}
149{-# INLINE fromPure #-}
150−fromPure :: b -> ParserChunked a m b
150+fromPure :: b -> ChunkParser a m b
151fromPure b = MkParser $ \n st arr pk -> pk (Success n b) st arr
151fromPure b = MkParser $ \n st arr pk -> pk (Success n b) st arr
153-- | See 'Streamly.Internal.Data.Parser.fromEffect'.
153-- | See 'Streamly.Internal.Data.Parser.fromEffect'.
@@ -155,7 +155,7 @@ fromPure b = MkParser $ \n st arr pk -> pk (Success n b) st arr
155-- /Pre-release/
155-- /Pre-release/
157{-# INLINE fromEffect #-}
157{-# INLINE fromEffect #-}
158−fromEffect :: Monad m => m b -> ParserChunked a m b
158+fromEffect :: Monad m => m b -> ChunkParser a m b
159fromEffect eff =
159fromEffect eff =
160 MkParser $ \n st arr pk -> eff >>= \b -> pk (Success n b) st arr
160 MkParser $ \n st arr pk -> eff >>= \b -> pk (Success n b) st arr
@@ -163,7 +163,7 @@ fromEffect eff =
163-- this operation does not fuse, use 'Streamly.Internal.Data.Parser.serialWith'
163-- this operation does not fuse, use 'Streamly.Internal.Data.Parser.serialWith'
164-- when fusion is important.
164-- when fusion is important.
166−instance Monad m => Applicative (ParserChunked a m) where
166+instance Monad m => Applicative (ChunkParser a m) where
167 {-# INLINE pure #-}
167 {-# INLINE pure #-}
168 pure = fromPure
168 pure = fromPure
@@ -200,7 +200,7 @@ instance Monad m => Applicative (ParserChunked a m) where
200-- /Pre-release/
200-- /Pre-release/
202{-# INLINE die #-}
202{-# INLINE die #-}
203−die :: String -> ParserChunked a m b
203+die :: String -> ChunkParser a m b
204die err = MkParser (\n st arr pk -> pk (Failure n err) st arr)
204die err = MkParser (\n st arr pk -> pk (Failure n err) st arr)
206-- | Monad composition can be used for lookbehind parsers, we can make the
206-- | Monad composition can be used for lookbehind parsers, we can make the
@@ -245,7 +245,7 @@ die err = MkParser (\n st arr pk -> pk (Failure n err) st arr)
245-- does not fuse, use 'Streamly.Internal.Data.Parser.concatMap' when you need
245-- does not fuse, use 'Streamly.Internal.Data.Parser.concatMap' when you need
246-- fusion.
246-- fusion.
248−instance Monad m => Monad (ParserChunked a m) where
248+instance Monad m => Monad (ChunkParser a m) where
249 {-# INLINE return #-}
249 {-# INLINE return #-}
250 return = pure
250 return = pure
@@ -264,11 +264,11 @@ instance Monad m => Monad (ParserChunked a m) where
264 {-# INLINE fail #-}
264 {-# INLINE fail #-}
265 fail = die
265 fail = die
267−instance Monad m => Fail.MonadFail (ParserChunked a m) where
267+instance Monad m => Fail.MonadFail (ChunkParser a m) where
268 {-# INLINE fail #-}
268 {-# INLINE fail #-}
269 fail = die
269 fail = die
271−instance MonadIO m => MonadIO (ParserChunked a m) where
271+instance MonadIO m => MonadIO (ChunkParser a m) where
272 {-# INLINE liftIO #-}
272 {-# INLINE liftIO #-}
273 liftIO = fromEffect . liftIO
273 liftIO = fromEffect . liftIO
@@ -289,7 +289,7 @@ instance MonadIO m => MonadIO (ParserChunked a m) where
289-- does not fuse, use 'Streamly.Internal.Data.Parser.alt' when you need
289-- does not fuse, use 'Streamly.Internal.Data.Parser.alt' when you need
290-- fusion.
290-- fusion.
292−instance Monad m => Alternative (ParserChunked a m) where
292+instance Monad m => Alternative (ChunkParser a m) where
293 {-# INLINE empty #-}
293 {-# INLINE empty #-}
294 empty = die "empty"
294 empty = die "empty"
@@ -322,7 +322,7 @@ instance Monad m => Alternative (ParserChunked a m) where
322-- | 'mzero' is same as 'empty', it aborts the parser. 'mplus' is same as
322-- | 'mzero' is same as 'empty', it aborts the parser. 'mplus' is same as
323-- '<|>', it selects the first succeeding parser.
323-- '<|>', it selects the first succeeding parser.
325−instance Monad m => MonadPlus (ParserChunked a m) where
325+instance Monad m => MonadPlus (ChunkParser a m) where
326 {-# INLINE mzero #-}
326 {-# INLINE mzero #-}
327 mzero = die "mzero"
327 mzero = die "mzero"