
On Sat, 2007-10-13 at 18:25 +0200, Henning Thielemann wrote:
Are there analogons to ByteString's Put and Get Monads to construct and disect binary data in a C struct for exchange with a C program?
It's certainly possible. As John Meacham says on most platforms there is a standard ABI (ie standard on that platform, not standard between platforms). So one could make a lib on top of Data.Binary.Get/Put that embeds the knowledge about some particular platform's C struct ABI and allows reading/writing them. Like, Data.Binary's Get/Put it could be used just via the Applicative combinators. You could probably also get a good deal of code re-use between different platform ABIs by parametrising by things like alignment, endianness, size of primitives etc. Duncan