On Jun 17, 2008, at 10:05 PM, Andrew Coppin wrote:

OK, so today I tried to write my first program using the Binary library. And I've hit a snag: It appears the library will only handle data that is byte-aligned. So if I try to write three Bool values, it uses three bytes, not three bits.

Before I sit down and spend 3 months designing my own library from scratch, does anybody know of an existing library that allows you to do what Binary does, but with single-bit precision? [I presume Binary is byte-aligned for efficiency...]

Andrew,

Maybe you could look at the generic encode/decode in this paper:
people.cs.uu.nl/johanj/publications/ComparingGP.pdf

When you look at some more literature about generic programming the (bit-aligned) encode and decode are quite common examples. It shouldn't be that hard to de-generify them, if you even want that.

--
Sebastiaan.




_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to