<div dir="ltr"><div>On 24 June 2016 at 11:41, Yuras Shumovich <span dir="ltr"><<a href="mailto:shumovichy@gmail.com" target="_blank">shumovichy@gmail.com</a>></span> wrote:<br></div><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><br>
I think it is possible (and easy) to implement with<br>
Data.ByteString.Builder. Just use the low-level interface: <a href="http://hacka" rel="noreferrer" target="_blank">http://hacka</a><br>
<a href="http://ge.haskell.org/package/bytestring-0.10.8.1/docs/Data-ByteString-
Builder-Extra.html#v:runBuilder" rel="noreferrer" target="_blank">ge.haskell.org/package/bytestring-0.10.8.1/docs/Data-ByteString-<br>
Builder-Extra.html#v:runBuilder</a><br>
<br>
BufferWriter takes a buffer to write to and returns a continuation to<br>
be called in case the buffer is too small. The idea is to allocate a<br>
buffer, but reserve necessary space for length and checksum. Then run<br>
the builder, get the resulting ByteString (or work directly with `Ptr<br>
Word8`), calculate length and check sum and write then into the<br>
reserved space.<br>
<br>
Just be careful when using the low level API, and read the docs<br>
carefully.<br></blockquote><div><br></div><div><br></div><div>Aha, thanks, that looks like just what I'm after! Great.<br></div><div><br></div><div><br></div><div>On 24 June 2016 at 10:39, Axel Mannhardt <span dir="ltr"><<a href="mailto:axel.mannhardt@freiheit.com" target="_blank">axel.mannhardt@freiheit.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><span class=""><br></span>this might be of interest to you - the explanation is in German though:<br><br><a href="http://nfa.imn.htwk-leipzig.de/HAL2015/programm/slides/breitner.pdf" rel="noreferrer" target="_blank">http://nfa.imn.htwk-leipzig.de/HAL2015/programm/slides/breitner.pdf</a><br><br>Cheers,<br>Axel</blockquote></div><div><br></div><div>My German is nonexistent but fortunately the code is English enough to read, thanks. Unfortunately,</div><div><br></div><div>> type ByteString = [Word8]
</div><div><br></div><div>This is not the ByteString I'm looking for!</div><div><br></div><div>Cheers,</div><div><br></div><div>David</div><div><br></div><div><br></div></div><br></div></div>