[Haskell-cafe] data.binary get reading beyond end of input
dagit at codersbase.com
Thu Jul 29 13:35:07 EDT 2010
On Thu, Jul 29, 2010 at 6:15 AM, Duncan Coutts <duncan.coutts at googlemail.com
> 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
> 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
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
Once that work is done how will binary differ from cereal? How will I know
which one to pick?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe