[Haskell-cafe] bitSize

Brandon Allbery allbery.b at gmail.com
Mon Aug 29 10:00:07 CEST 2011

On Mon, Aug 29, 2011 at 03:40, Andrew Coppin <andrewcoppin at btinternet.com>wrote:

>    I meant if you're trying to *implement* serialisation. The Bits
>>    class allows you to access bits one by one, but surely you'd want
>>    some way to know how many bits you need to keep?
>> I think that falls into the realm of protocol design; if you're doing it
>> in your program at runtime, you're probably doing it wrong.  (The fixed
>> size version makes sense for marshaling; it's *dynamic* sizes that need
>> to be thought out beforehand.)
> If you're doing, say, cryptography, then thousand-bit random integers that
> need to be serialised are fairly common...

Sure, and there are encodings that let you do this without needing bitSize
(BER).  You need a word count, but that's usually part of the structure
holding the integer.

brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110829/1c4215b1/attachment.htm>

More information about the Haskell-Cafe mailing list