[Haskell-cafe] Re: ANN: A triple of new packages for talking tothe outside world

Dominic Steinitz dominic.steinitz at blueyonder.co.uk
Wed Jan 9 10:10:07 EST 2008


Duncan Coutts <duncan.coutts <at> worc.ox.ac.uk> writes:

> 
> 
> On Wed, 2008-01-09 at 09:26 +0000, Dominic Steinitz wrote:
> > Adam Langley <agl <at> imperialviolet.org> writes:
> > 
> > > But if this is useful to you, make any requests. I'll (hopefully) do
> > > them, clean it up and push a new release of binary-strict.
> > > 
> > How difficult would it be to have a getBits functions as well as a getBytes?
> > That would allow me drop the dependency on NewBinary in the ASN.1 package.
> 
> The difficulty is in deciding what the api should be. Does it give you a
> real bitstream or only a byte aligned one? If I ask for 3 bits then 15
> bytes what does it do? Does it assume I meant 3 bits, then pad to the
> next byte boundary and get 15 bytes, or does it mean get 15 bytes but at
> this 3 bit shift offset?
> 
> Duncan
> 

I'd suggest an aligned and unaligned api. 

So the aligned api would get 3 bits and the 15 bytes would start from the next
byte boundary.

The unaligned api would get 3 bits and the 15 bytes (=15 x 8 bits) would finish
still with an offset of 3.

Dominic.




More information about the Haskell-Cafe mailing list