<br><br><div class="gmail_quote">On Thu, Jul 29, 2010 at 6:15 AM, Duncan Coutts <span dir="ltr">&lt;<a href="mailto:duncan.coutts@googlemail.com">duncan.coutts@googlemail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im"><br></div><div class="im">
<br>
</div>No idea what WrappedByteString is.<br></blockquote><div><br></div><div>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&#39;re interested:</div>
<div><a href="http://hackage.haskell.org/packages/archive/iteratee/0.3.5/doc/html/src/Data-Iteratee-WrappedByteString.html">http://hackage.haskell.org/packages/archive/iteratee/0.3.5/doc/html/src/Data-Iteratee-WrappedByteString.html</a></div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
It would look like attoparsec&#39;s resumable parser:<br>
<br>
data Result a = Fail !ByteString<br>
              | Partial (ByteString -&gt; Result a)<br>
              | Done !ByteString a<br>
<br>
runGet :: Get a -&gt; ByteString -&gt; Result a<br>
<br>
Point is you feed it strict bytestring chunks. Then decoding a lazy<br>
bytestring can be implemented on top easily, as can decoding a sequence<br>
lazily.<br></blockquote><div> </div><div>Like attoparsec you&#39;ll probably want to write some other utility functions for working with Results.  Attoparsec defines feed, parseWith, maybeResult, and eitherResult.  I think you&#39;ll want something similar here. </div>
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
I imagine you could fairly easily interface it with iteratee too.<br></blockquote><div><br></div><div>Yes that should be easy given the above API.  See for example the attoparsec-iteratee package.</div><div><br></div><div>
Once that work is done how will binary differ from cereal?  How will I know which one to pick?</div><div><br></div><div>Thanks,</div><div>Jason</div></div>