<div class="gmail_quote">On 10 January 2011 01:08, Antoine Latter <span dir="ltr">&lt;<a href="mailto:aslatter@gmail.com">aslatter@gmail.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">On Sun, Jan 9, 2011 at 6:05 PM, Aaron Gray &lt;<a href="mailto:aaronngray.lists@gmail.com">aaronngray.lists@gmail.com</a>&gt; wrote:<br>
&gt; On 9 January 2011 21:30, Henning Thielemann &lt;<a href="mailto:lemming@henning-thielemann.de">lemming@henning-thielemann.de</a>&gt;<br>
&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Sun, 9 Jan 2011, Aaron Gray wrote:<br>
&gt;&gt;<br>
&gt;&gt;&gt; I am trying to work out how to use GHC.Ptr, Foreign.Storable,<br>
&gt;&gt;&gt; Data.Storable.Endian, and<br>
&gt;&gt;&gt; am looking for good examples of usage.<br>
&gt;&gt;<br>
&gt;&gt; What do you intend to do with them?<br>
&gt;&gt;<br>
&gt;<br>
&gt; An (ABC) ActionScript Byte Code backend for Haskell.<br>
&gt; Basically I need to write little-endian binary to a file, and was wondering<br>
&gt; the best way to do this; I need various types including a 24bit type.<br>
&gt;<br>
<br>
</div>Ah, I would recommend the &#39;binary&#39; package on hackage, specifically<br>
the module Data.Binary.Builder. Another recently popular alternative<br>
is the &#39;blaze-builder&#39; package.<br></blockquote><div><br></div><div>It does say that it is designed to work with bigendian data, but there are some little-endian primatives in Data.Binary.Get/Put</div><div><br></div>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
Although the 24-bit access might be difficult - how are they aligned?<br>
<br></blockquote><div> </div><div>They are non aligned, they are actually used as jump offsets in the byte code.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


I guess with either of these you&#39;d have to peek a Word8 and then a<br>
Word16 and then munge them together, depending.<br></blockquote><div><br></div><div>Three put/getWord8&#39;s would probably be neater. </div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">


<br>
<a href="http://hackage.haskell.org/package/binary" target="_blank">http://hackage.haskell.org/package/binary</a><br>
<a href="http://hackage.haskell.org/package/blaze-builder" target="_blank">http://hackage.haskell.org/package/blaze-builder</a></blockquote><div><br></div><div>Blaze looks a bit more specialized.</div><div><br></div><div>

Many thanks,</div><div><br></div><div>Aaron</div><div><br></div></div>