Proposal: Add hasBitSize to Data.Bits.Bits

Thomas DuBuisson thomas.dubuisson at gmail.com
Tue Aug 28 18:18:34 CEST 2012


On Tue, Aug 28, 2012 at 9:07 AM, Ben Millwood <haskell at benmachine.co.uk> wrote:
> Wouldn't it be possible to have an instance Bits ByteString, or Vector
> Bool or something, where the bitsize would depend on the bytestring
> length, and hence wouldn't be fixed?

You mean like NumLazyByteString [1]?  Not only possible but its done
at least once (poorly) and deprecated.

[1] hackage.haskell.org/packages/archive/NumLazyByteString/0.0.0.1/doc/html/src/Data-ByteString-Lazy-Num.html

>
> (although if we're catering for that sort of use, the docs will need
> to be changed)
>
> On Sun, Aug 26, 2012 at 9:53 PM, Henning Thielemann
> <lemming at henning-thielemann.de> wrote:
>>
>> On Sun, 26 Aug 2012, Ian Lynagh wrote:
>>
>>> On Wed, Aug 22, 2012 at 07:49:49PM -0400, Edward Kmett wrote:
>>>>
>>>>
>>>> deprecate, but not remove bitSize this iteration, and make a separate
>>>> class FiniteBits for things with a finite, fixed number of bits:
>>>>
>>>>> class Bits b => FiniteBits b where
>>>>>    finiteBitSize :: b -> Int
>>>>>    finiteBitSize = bitSize
>>
>>
>>
>> Bit size is always finite in strict data types, isn't it? I suggest a name
>> containing "Fixed".
>>
>>
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://www.haskell.org/mailman/listinfo/libraries
>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries



More information about the Libraries mailing list