[Haskell-cafe] GHC.Ptr, Foreign.Storable, Data.Storable.Endian, looking for good examples of usage
aaronngray.lists at gmail.com
Mon Jan 10 03:11:42 CET 2011
On 10 January 2011 01:08, Antoine Latter <aslatter at gmail.com> wrote:
> On Sun, Jan 9, 2011 at 6:05 PM, Aaron Gray <aaronngray.lists at gmail.com>
> > On 9 January 2011 21:30, Henning Thielemann <
> lemming at henning-thielemann.de>
> > wrote:
> >> On Sun, 9 Jan 2011, Aaron Gray wrote:
> >>> I am trying to work out how to use GHC.Ptr, Foreign.Storable,
> >>> Data.Storable.Endian, and
> >>> am looking for good examples of usage.
> >> What do you intend to do with them?
> > An (ABC) ActionScript Byte Code backend for Haskell.
> > Basically I need to write little-endian binary to a file, and was
> > the best way to do this; I need various types including a 24bit type.
> Ah, I would recommend the 'binary' package on hackage, specifically
> the module Data.Binary.Builder. Another recently popular alternative
> is the 'blaze-builder' package.
It does say that it is designed to work with bigendian data, but there are
some little-endian primatives in Data.Binary.Get/Put
> Although the 24-bit access might be difficult - how are they aligned?
They are non aligned, they are actually used as jump offsets in the byte
> I guess with either of these you'd have to peek a Word8 and then a
> Word16 and then munge them together, depending.
Three put/getWord8's would probably be neater.
Blaze looks a bit more specialized.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe