
On Sat, Mar 8, 2008 at 10:11 PM, Adam Langley
On Sat, Mar 8, 2008 at 12:56 AM, Johan Tibell
wrote: The problem -- maybe there are others too -- is that when a parser such as
many (byte 65)
is run it will always return a 'Partial' result waiting for more input even though the enumerator is exhausted. In other words, there's no way to detect end of input.
It appears that you need some way to distinguish the end of input from, "that's all I have for now". You could use an empty Bytestring in S if you were careful that you maintained that, in normal processing, such a state doesn't arise. Otherwise, have a Maybe in your state and set it to Nothing when the input is exhausted. Then have combinators, like many, handle the EOF case sensibly.
I changed the type of Partial to Maybe ByteString -> Result a so that the client can specify EOF. -- Johan