On Thu, Jul 29, 2010 at 6:15 AM, Duncan Coutts <duncan.coutts@googlemail.com
wrote:
No idea what WrappedByteString is.
WrappedByteString is a newtype wrapper around ByteString that has a phantom type. This allows instances of to be written such that ByteString can be used with the iteratee library. You can see the source here if you're interested: http://hackage.haskell.org/packages/archive/iteratee/0.3.5/doc/html/src/Data...
It would look like attoparsec's resumable parser:
data Result a = Fail !ByteString | Partial (ByteString -> Result a) | Done !ByteString a
runGet :: Get a -> ByteString -> Result a
Point is you feed it strict bytestring chunks. Then decoding a lazy bytestring can be implemented on top easily, as can decoding a sequence lazily.
Like attoparsec you'll probably want to write some other utility functions for working with Results. Attoparsec defines feed, parseWith, maybeResult, and eitherResult. I think you'll want something similar here.
I imagine you could fairly easily interface it with iteratee too.
Yes that should be easy given the above API. See for example the attoparsec-iteratee package. Once that work is done how will binary differ from cereal? How will I know which one to pick? Thanks, Jason