on master help sign in
Add a comment about Input type for parser
commit30f219927462a87e8ab1a197d4d0e9b3d55c7e20 authorHarendra Kumar <harendra@composewell.com> dateWed 2 Aug 2023, 19:59 (3 years ago) parentd304fb8
1 file changed+3−1
core/src/Streamly/Internal/Data/Parser/ParserK/Type.hs+3−1
core/src/Streamly/Internal/Data/Parser/ParserK/Type.hs+3−1
@@ -53,6 +53,9 @@ import qualified Control.Monad.Fail as Fail
5353import qualified Streamly.Internal.Data.Array.Type as Array
5454import qualified Streamly.Internal.Data.Parser.ParserD.Type as ParserD
5555
56+-- Note: We cannot use an Array directly as input because we need to identify
57+-- the end of input case using None. We cannot do that using nil Array as nil
58+-- Arrays can be encountered in normal input as well.
5659data Input a = None | Chunk {-# UNPACK #-} !(Array a)
5760
5861-- | The intermediate result of running a parser step. The parser driver may
@@ -142,7 +145,6 @@ newtype ParserK a m b = MkParser
142145 -- The second argument is the used count as described above. The
143146 -- current input position is carried as part of 'Success'
144147 -- constructor of 'ParseResult'.
145− -- XXX Use Array a, determine eof by using a nil array
146148 -> Input a
147149 -> m (Step a m r)
148150 }