Some trouble with AttoParsec.

The linked to text demoes a seemingly impossible error when processing a lazy byte string with AttoParsec: I check to see if the ByteString is null, take the last character and get an exception. -- Jason Dusek http://hpaste.org/fastcgi/hpaste.fcgi/view?id=8309#a8309

Aha. From `Data.ByteString.Lazy` we have: null :: ByteString -> Bool null Empty = True null _ = False So either users need to norm ByteStrings before testing them for emptiness or it needs to happen within the ByteString code... -- Jason Dusek

2009/08/19 Jason Dusek
Aha. From `Data.ByteString.Lazy` we have:
null :: ByteString -> Bool null Empty = True null _ = False
So either users need to norm ByteStrings before testing them for emptiness or it needs to happen within the ByteString code...
Well, no, actually -- the lazy `ByteString` constructors are all supposed to conform to the invariant that there are no empty chunks. So something is funny with AttoParsec: Prelude Data.ParserCombinators.Attoparsec.Char8 Data.ByteString.Lazy.Char8> parse (takeTill (== '"')) (pack "\"\"") (Chunk "\"" Empty,Right (Chunk "" Empty)) it :: (ByteString, Either ParseError ByteString) Sorry to hash this out on the list; I'm used to think of my troubles with Haskell libs as misunderstandings on my part. I'll have to look into what AttoParsec is doing and file a bug report. -- Jason Dusek
participants (1)
-
Jason Dusek