[Mid-discussion Summary] Proposal: add new Data.Bits.Bits(bitZero) method

Herbert Valerio Riedel hvr at gnu.org
Sat Feb 22 10:03:12 UTC 2014


Hello *,

Here's a mid-discussion summary of the proposal

>> Introduce a new class method
>>
>>   class Bits a where
>>       ...
>>       -- | Value with all bits cleared
>>       <0-value-method> :: a
>>       ...
>>
>> modulo naming of '<0-value-method>'

from my point of view:

 - The idea came up already in 2011 when Num-superclass was to be removed from Bits
   (but discussion derailed)

 - So far general consensus (i.e. no "-1"s afaics) it's desired to have
   an all-bits-clear value introducing method in 'Bits'

 - Use "clearBit (bit 0) 0" as default implementation for smooth upgrade-path

 - Nameing for <0-value-method> boils down to two candidates:

    a) 'Data.Bits.zero'

        - based on the idea tha 'Data.Bits' ought to be imported
          qualified (or with explicit import-list) anyway
          (-> thus following PVP practice)

        - many existing Data.Bits.Bits methods such as 'rotate',
          'complement', 'popCount', 'xor', or 'shift' don't have
          the name 'bit' in it (and those few that have, operate
          on single bits)

        - supporters (in no particular order):

           - ARJANEN Loïc Jean David
           - Henning Thielemann
           - Herbert Valerio Riedel (+0.99)
           - Twan van Laarhoven

    b) 'Data.Bits.zeroBits'

        - more verbose name reduces risk of namespace conflicts with unqualified imports

        - supporters (in no particular order):

           - Edward Kmett
           - Eric Mertens
           - Herbert Valerio Riedel
           - Twan van Laarhoven
           - (maybe?) ARJANEN Loïc Jean David


    So far there doesn't seem to be a very clear preference for
    'zeroBits' over 'zero'. It might help, if those how expressed some
    kind of support for both variants could clarify if their preference
    has any bias towards 'zeroBits' or 'zero'.


Cheers,
   hvr


More information about the Libraries mailing list