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