Proposal: add new Data.Bits.Bits(bitZero) method

Henning Thielemann schlepptop at
Sun Feb 16 16:49:23 UTC 2014

Am 16.02.2014 17:42, schrieb Herbert Valerio Riedel:

>> Introduce a new class method
>>    class Bits a where
>>        ...
>>        -- | Value with all bits cleared
>>        bitZero :: a
>>        ...
>> modulo naming of 'bitZero'
> (I'm hesitant to consume "zero" from the namespace as was suggested by Henning)

Let me defend "zero": Functions in the module that contain "Bit" in the 
name (clearBit, setBit, testBit) access a single bit. All functions that 
access many bits do not contain "Bit" (rotate, shift, xor, popCount). I 
propose to import the "zero" function with qualification, as well as the 
other functions from the module.

I also propose to provide a default implementation of "zero", like 
"clearBit (bit 0) 0". This way, the "zero" method can be introduced 
without breaking existing code.

More information about the Libraries mailing list