
I'm writing a Storable instance for a data type that marshals to a C structure that contains bit fields such as the following: struct Foo { short x; short y; unsigned int a : 1; unsigned int b : 1; unsigned int c : 1; unsigned int d : 1; unsigned int reserved : 12; } For the "x" and "y" fields I've been using hsc2hs and something like #{peek Foo, x} to extract the fields. However, bit fields such as "a" have me stumped. But as far as I can tell, hsc2hs doesn't support bit fields. On top of that I'm not sure I can make any safe assumptions about what order the bit fields are packed (LSB or MSB first). Have others run into this problem before? What options are there for working around it? Michael D. Adams mdmkolbe@gmail.com