[Haskell-cafe] Re: Some trouble with AttoParsec.

Jason Dusek jason.dusek at gmail.com
Wed Aug 19 06:07:39 EDT 2009


2009/08/19 Jason Dusek <jason.dusek at gmail.com>:
>  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


More information about the Haskell-Cafe mailing list