on master help sign in
Add a comment about Input type for parser
30f2199Harendra Kumar
core/src/Streamly/Internal/Data/Parser/ParserK/Type.hs+3−1
@@ -53,6 +53,9 @@ import qualified Control.Monad.Fail as Fail
53import qualified Streamly.Internal.Data.Array.Type as Array
53import qualified Streamly.Internal.Data.Array.Type as Array
54import qualified Streamly.Internal.Data.Parser.ParserD.Type as ParserD
54import qualified Streamly.Internal.Data.Parser.ParserD.Type as ParserD
55
55
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.
56data Input a = None | Chunk {-# UNPACK #-} !(Array a)
59data Input a = None | Chunk {-# UNPACK #-} !(Array a)
57
60
58-- | The intermediate result of running a parser step. The parser driver may
61-- | The intermediate result of running a parser step. The parser driver may
@@ -142,7 +145,6 @@ newtype ParserK a m b = MkParser
142 -- The second argument is the used count as described above. The
145 -- The second argument is the used count as described above. The
143 -- current input position is carried as part of 'Success'
146 -- current input position is carried as part of 'Success'
144 -- constructor of 'ParseResult'.
147 -- constructor of 'ParseResult'.
145− -- XXX Use Array a, determine eof by using a nil array
146 -> Input a
148 -> Input a
147 -> m (Step a m r)
149 -> m (Step a m r)
148 }
150 }