[Haskell-cafe] GHC.Ptr, Foreign.Storable, Data.Storable.Endian, looking for good examples of usage

Antoine Latter aslatter at gmail.com
Mon Jan 10 02:08:23 CET 2011

On Sun, Jan 9, 2011 at 6:05 PM, Aaron Gray <aaronngray.lists at gmail.com> wrote:
> 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 wondering
> 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.

Although the 24-bit access might be difficult - how are they aligned?

I guess with either of these you'd have to peek a Word8 and then a
Word16 and then munge them together, depending.



>> The package storablevector uses a lot of Ptr, peek, and poke. Maybe this
>> is of some help.
> Okay thanks,
> Aaron
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

More information about the Haskell-Cafe mailing list