[Haskell-cafe] attoparsec and parsec

Jason Dusek jason.dusek at gmail.com
Sat Nov 14 20:16:45 EST 2009

  To add to the confusion, I forked `bytestringparser` when I
  wrote the `json-b` package. The fork is here:


  I have added a number of things to original as well as fixing
  some problems with it.

  The reason I went with the older package is that the new one
  depended on stuff that wouldn't build on Hackage so I was like
  "whatever"; however, I now consider that it might have been
  better to work off the newer package.

  A subtle error, corrected in my version, seems yet to be
  present in the `attoparsec-0.7.2`, in an operator used
  internally to build up the result set.

    {-# LINE 132 "Data/Attoparsec/Internal.hs" #-}
    -- | Turn our split representation back into a normal lazy ByteString.
    (+:) :: SB.ByteString -> LB.ByteString -> LB.ByteString
    sb +: lb | SB.null sb = lb
             | otherwise = LB.Chunk sb lb

  Where this operator showed up in `bytestringparser`, I
  replaced `LB.Chunk` with the smart constructor, `LB.chunk`, to
  ensure that the "no empty chunks" invariant of lazy
  `ByteString`s was followed (I discovered this failing one
  evening when I was fleshing out the JSON parser).

Jason Dusek

More information about the Haskell-Cafe mailing list