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

Aaron Gray aaronngray.lists at gmail.com
Tue Jan 11 00:23:50 CET 2011


On 10 January 2011 22:30, Henning Thielemann
<lemming at henning-thielemann.de>wrote:

> John Lato schrieb:
>
> > You could use my "word24" package[1] (GHC only) to provide non-aligned
> > 24-bit word and int types with Storable instances.  You should be able
> > to write a binary instance (or whatever blaze-builder needs) fairly
> > simply from this.  Little-endian only ATM, but BE could be added if
> > necessary.
>
> Good to know that! However, I think for the original poster the binary
> package is perfect. This way he does not worry about unsafe peeking and
> poking around in memory.
>
>
Yes. I have came back to looking at the binary package, the only thing is I
think I have to build my own primatives with it as it is big-endian, where
ActionScript Byte Code format is little-endian. It does provide some
little-endian functions but they are not brought to the surface. It also
seems to roll its own serializations.

I am maybe looking at doing my own specialized set of types and binary
backend as there are drawback with each of the existing solutions.

  - Data.Storable.Endian - peeks and pokes rather than put/get
  - Data.Word24 - peeks and pokes rather than put/get
  - Data.Binary - big-endian

ABC format may best be supported by a specific set of serialization types.

On a different note thinking outside this problem, I would like IO_LE and
IO_BE types if that could be make to work.

Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110110/72bd15e6/attachment.htm>


More information about the Haskell-Cafe mailing list